mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-07-30 19:41:56 +00:00
Protect against segfaults calling destroyed closures
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 is contained in:
@@ -119,3 +119,7 @@ exports.pass_reference_first_arg_twice = (a, b, c) => {
|
||||
c(a);
|
||||
a.free();
|
||||
};
|
||||
|
||||
exports.call_destroyed = f => {
|
||||
assert.throws(f, /invoked recursively or destroyed/);
|
||||
};
|
||||
|
Reference in New Issue
Block a user