mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-07-15 16:58:34 +00:00
host_consume_stack_and_call_indirect: add an ad-hoc overflow detection
This commit is contained in:
parent
b511ad9c50
commit
262075db02
|
@ -38,6 +38,11 @@ host_consume_stack_and_call_indirect(wasm_exec_env_t exec_env, uint32_t funcidx,
|
|||
void *boundary = os_thread_get_stack_boundary();
|
||||
void *fp = __builtin_frame_address(0);
|
||||
ptrdiff_t diff = fp - boundary;
|
||||
if ((unsigned char *)fp < (unsigned char *)boundary + 1024 * 5) {
|
||||
wasm_runtime_set_exception(wasm_runtime_get_module_inst(exec_env),
|
||||
"native stack overflow 2");
|
||||
return 0;
|
||||
}
|
||||
if (diff > stack) {
|
||||
prev_diff = diff;
|
||||
nest++;
|
||||
|
|
Loading…
Reference in New Issue
Block a user