Skip to content
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

Protect against segfaults calling destroyed closures #1530

Merged
merged 1 commit into from
May 13, 2019

Conversation

alexcrichton
Copy link
Contributor

This commit updates the drop glue generated for closures to simply
ignore null pointers. The drop glue can be called in erroneous
situations such as when a closure is invoked after it's been destroyed.
In these cases we don't want to segfault and/or corrupt memory but
instead let the normal error message from the invoke glue continue to
get propagated.

Closes #1526

This commit updates the drop glue generated for closures to simply
ignore null pointers. The drop glue can be called in erroneous
situations such as when a closure is invoked after it's been destroyed.
In these cases we don't want to segfault and/or corrupt memory but
instead let the normal error message from the invoke glue continue to
get propagated.

Closes rustwasm#1526
@fitzgen fitzgen merged commit c504c38 into rustwasm:master May 13, 2019
@takkuumi
Copy link

takkuumi commented May 17, 2019

@alexcrichton

But now, there was another bug.

Error: closure invoked recursively or destroyed already
    at module.exports.__wbindgen_throw (/Users/ling/Codelab/tswasm/rust_assembly/pkg/rust_assembly.js:390:11)
    at wasm_bindgen::throw_str::hda700a983b9b66a8 (wasm-function[121]:5)
    at <dyn +core::ops::function::FnMut<()>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h72c772442484abe4 (wasm-function[51]:65)
    at Function.cb (/Users/ling/Codelab/tswasm/rust_assembly/pkg/rust_assembly.js:401:20)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7)

for issue RuntimeError: memory access out of bounds #1526

@alexcrichton alexcrichton deleted the drop-glue-closures branch May 17, 2019 14:14
@alexcrichton
Copy link
Contributor Author

@NateLing I believe that is a legitimate bug in that branch (if it's the same as I remember) which is JS calling a destroyed closure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RuntimeError: memory access out of bounds
3 participants