-
Notifications
You must be signed in to change notification settings - Fork 838
Fix SafeHeap crash when start function calls an imported function #8306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||
| ;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. | ||||||
| ;; RUN: wasm-opt %s --safe-heap --enable-threads --enable-simd -S -o - | filecheck %s | ||||||
|
|
||||||
| ;; Test that safe-heap does not crash when the start function calls an imported | ||||||
| ;; function. The findCalledFunctions helper transitively walks all called | ||||||
| ;; functions from the start, and must skip imported functions which have no body. | ||||||
|
|
||||||
| (module | ||||||
| ;; CHECK: (import "env" "some_import" (func $import)) | ||||||
| (import "env" "some_import" (func $import)) | ||||||
| ;; CHECK: (import "env" "emscripten_get_sbrk_ptr" (func $emscripten_get_sbrk_ptr (result i32))) | ||||||
| (import "env" "emscripten_get_sbrk_ptr" (func $emscripten_get_sbrk_ptr (result i32))) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
No need for this import. |
||||||
| (memory 1 1 shared) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
No need for this to be shared. |
||||||
|
|
||||||
| ;; CHECK: (start $start) | ||||||
|
|
||||||
| ;; CHECK: (func $start | ||||||
| ;; CHECK-NEXT: (call $import) | ||||||
| ;; CHECK-NEXT: ) | ||||||
| (func $start | ||||||
| ;; The start function calls an imported function. Previously this would | ||||||
| ;; crash because findCalledFunctions would try to walk the null body of | ||||||
| ;; the imported function. | ||||||
| (call $import) | ||||||
| ) | ||||||
|
|
||||||
| (start $start) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By convention we put this before the first function (around line 16, here) |
||||||
| ) | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These features are not used in the testcase.