Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions core/iwasm/interpreter/wasm_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -11228,21 +11228,23 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
uint32 cell_num =
wasm_value_type_cell_num(func_type->types[i]);
if (i >= available_params) {
/* make sure enough space */
if (loader_ctx->p_code_compiled == NULL) {
loader_ctx->frame_offset += cell_num;
if (!check_offset_push(loader_ctx, error_buf,
error_buf_size))
goto fail;
/* for following dummy value assignemnt */
loader_ctx->frame_offset -= cell_num;
}

/* If there isn't enough data on stack, push a dummy
* offset to keep the stack consistent with
* frame_ref.
* Since the stack is already in polymorphic state,
* the opcode will not be executed, so the dummy
* offset won't cause any error */
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;
}
for (uint32 n = 0; n < cell_num; n++) {
*loader_ctx->frame_offset++ = 0;
}
}
Expand Down
Loading