fast-interp: Fix frame_offset overflow issue (#3149)

The issue was found in https://github.com/bytecodealliance/wasm-micro-runtime/issues/3137.
This commit is contained in:
Xu Jun 2024-02-08 11:32:17 +08:00 committed by GitHub
parent 7cac0531ad
commit 12f834aebd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 4 deletions

View File

@ -10796,8 +10796,15 @@ re_scan:
* Since the stack is already in polymorphic state,
* the opcode will not be executed, so the dummy
* offset won't cause any error */
*loader_ctx->frame_offset++ = 0;
if (cell_num > 1) {
uint32 n;
for (n = 0; n < cell_num; n++) {
if (loader_ctx->p_code_compiled == NULL) {
if (!check_offset_push(loader_ctx,
error_buf,
error_buf_size))
goto fail;
}
*loader_ctx->frame_offset++ = 0;
}
}

View File

@ -5931,8 +5931,15 @@ re_scan:
* Since the stack is already in polymorphic state,
* the opcode will not be executed, so the dummy
* offset won't cause any error */
*loader_ctx->frame_offset++ = 0;
if (cell_num > 1) {
uint32 n;
for (n = 0; n < cell_num; n++) {
if (loader_ctx->p_code_compiled == NULL) {
if (!check_offset_push(loader_ctx,
error_buf,
error_buf_size))
goto fail;
}
*loader_ctx->frame_offset++ = 0;
}
}