Skip to content

Commit

Permalink
Fix label index out-of-range references in op_br_table_cache (#2615)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
funera1 authored Oct 3, 2023
1 parent 1a88104 commit 64baf54
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/iwasm/interpreter/wasm_interp_classic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
while (node_cache) {
node_next = bh_list_elem_next(node_cache);
if (node_cache->br_table_op_addr == frame_ip - 1) {
if (lidx > node_cache->br_count)
lidx = node_cache->br_count;
depth = node_cache->br_depths[lidx];
goto label_pop_csp_n;
}
Expand Down

0 comments on commit 64baf54

Please sign in to comment.