Skip to content

Commit 64baf54

Browse files
authored
Fix label index out-of-range references in op_br_table_cache (#2615)
Fixed a bug in the processing of the br_table_cache opcode that caused out-of-range references when the label index was greater than the length of the label.
1 parent 1a88104 commit 64baf54

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/iwasm/interpreter/wasm_interp_classic.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
14181418
while (node_cache) {
14191419
node_next = bh_list_elem_next(node_cache);
14201420
if (node_cache->br_table_op_addr == frame_ip - 1) {
1421+
if (lidx > node_cache->br_count)
1422+
lidx = node_cache->br_count;
14211423
depth = node_cache->br_depths[lidx];
14221424
goto label_pop_csp_n;
14231425
}

0 commit comments

Comments
 (0)