summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Nieves <christian@nieves.io>2024-09-20 11:33:40 -0500
committerGitHub <noreply@github.com>2024-09-20 09:33:40 -0700
commitb287470b53ef074332c4b0056cfc05486a85c4a7 (patch)
treeab4df3c39d15cd24b5347bc659a3b649b4140ac6
parent54b3f5fbd5cc851b4efe1b6ffd3331612c87c0e9 (diff)
downloadwabt-b287470b53ef074332c4b0056cfc05486a85c4a7.tar.gz
wabt-b287470b53ef074332c4b0056cfc05486a85c4a7.tar.bz2
wabt-b287470b53ef074332c4b0056cfc05486a85c4a7.zip
[wasm2c] Fix alternate stack deallocation (#2466)
This makes `wasm_rt_init()` properly reentrant. By setting `g_alt_stack = NULL`, we allow execution to continue beyond [wasm-rt-impl.c L171 ](https://github.com/WebAssembly/wabt/blob/main/wasm2c/wasm-rt-impl.c#L171) in `os_allocate_and_install_altstack`. Applies to debug builds only due to `assert`.
-rw-r--r--wasm2c/wasm-rt-impl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/wasm2c/wasm-rt-impl.c b/wasm2c/wasm-rt-impl.c
index 36bb9690..d02a70f1 100644
--- a/wasm2c/wasm-rt-impl.c
+++ b/wasm2c/wasm-rt-impl.c
@@ -224,6 +224,7 @@ static void os_disable_and_deallocate_altstack(void) {
}
assert(!os_has_altstack_installed());
free(g_alt_stack);
+ g_alt_stack = NULL;
}
#endif