Add more operand stack overflow checks for fast-interp (#1104)

And clear some compile warnings on Windows
This commit is contained in:
Wenyong Huang
2022-04-20 16:19:12 +08:00
committed by GitHub
parent 0f505aafd9
commit d6e781af28
5 changed files with 29 additions and 11 deletions

View File

@ -179,8 +179,12 @@ wasm_exec_env_alloc_wasm_frame(WASMExecEnv *exec_env, unsigned size)
bh_assert(!(size & 3));
/* The outs area size cannot be larger than the frame size, so
multiplying by 2 is enough. */
/* For classic interpreter, the outs area doesn't contain the const cells,
its size cannot be larger than the frame size, so here checking stack
overflow with multiplying by 2 is enough. For fast interpreter, since
the outs area contains const cells, its size may be larger than current
frame size, we should check again before putting the function arguments
into the outs area. */
if (addr + size * 2 > exec_env->wasm_stack.s.top_boundary) {
/* WASM stack overflow. */
return NULL;