From 740a48d3d8808760fc955bfc9dfa6bce5b264261 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Mon, 22 Apr 2024 13:16:43 +0900 Subject: [PATCH] canary --- samples/native-stack-overflow/src/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/samples/native-stack-overflow/src/main.c b/samples/native-stack-overflow/src/main.c index 49c8f300f..1f24be48d 100644 --- a/samples/native-stack-overflow/src/main.c +++ b/samples/native-stack-overflow/src/main.c @@ -101,11 +101,15 @@ main(int argc, char **argv) const char *exception = NULL; nest = 0; - uint32_t *x = os_thread_get_stack_boundary(); + uint32_t *x = (void *)os_thread_get_stack_boundary(); x[-1] = 0xaabbccdd; x[-2] = 0x12345678; + x[-3] = 0xdeadbeef; + x[-4] = 0xcafecdef; assert(x[-1] == 0xaabbccdd); assert(x[-2] == 0x12345678); + assert(x[-3] == 0xdeadbeef); + assert(x[-4] == 0xcafecdef); module_inst = wasm_runtime_instantiate(module, stack_size, heap_size, error_buf, sizeof(error_buf)); @@ -145,6 +149,8 @@ main(int argc, char **argv) } assert(x[-1] == 0xaabbccdd); assert(x[-2] == 0x12345678); + assert(x[-3] == 0xdeadbeef); + assert(x[-4] == 0xcafecdef); /* * note: non-zero "nest" here demonstrates resource leak on longjmp * from signal handler.