Skip to content

Commit fcbe97d

Browse files
committed
add check_dynamic_offset_pop
1 parent cbb6d03 commit fcbe97d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

core/iwasm/interpreter/wasm_loader.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8426,6 +8426,14 @@ check_offset_pop(WASMLoaderContext *ctx, uint32 cells)
84268426
return true;
84278427
}
84288428

8429+
static bool
8430+
check_dynamic_offset_pop(WASMLoaderContext *ctx, uint32 cells)
8431+
{
8432+
if (ctx->dynamic_offset < cells)
8433+
return false;
8434+
return true;
8435+
}
8436+
84298437
static void
84308438
free_label_patch_list(BranchBlock *frame_csp)
84318439
{
@@ -9860,8 +9868,10 @@ wasm_loader_pop_frame_offset(WASMLoaderContext *ctx, uint8 type,
98609868
stack will not go underflow. But we don't thrown error
98619869
and return true here, because the error msg should be
98629870
given in wasm_loader_pop_frame_ref */
9863-
if (!check_offset_pop(ctx, cell_num_to_pop))
9871+
if (!check_offset_pop(ctx, cell_num_to_pop)
9872+
|| !check_dynamic_offset_pop(ctx, cell_num_to_pop)) {
98649873
return true;
9874+
}
98659875

98669876
ctx->frame_offset -= cell_num_to_pop;
98679877
if ((*(ctx->frame_offset) > ctx->start_dynamic_offset)

0 commit comments

Comments
 (0)