mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-11 12:11:14 +00:00
Fix wasm loader issues (#1363)
Should not clear last label's polymorphic state after current label is popped Fix invalid func_idx check in opcode REF_FUNC Add check when there are extra unneeded bytecodes for a wasm function
This commit is contained in:
parent
4b00432c1a
commit
1fff8d5cbc
|
@ -6915,14 +6915,14 @@ re_scan:
|
|||
loader_ctx->frame_csp->end_addr = p - 1;
|
||||
}
|
||||
else {
|
||||
/* end of function block, function will return,
|
||||
ignore the following bytecodes */
|
||||
p = p_end;
|
||||
|
||||
continue;
|
||||
/* end of function block, function will return */
|
||||
if (p < p_end) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"section size mismatch");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
SET_CUR_BLOCK_STACK_POLYMORPHIC_STATE(false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -7588,7 +7588,7 @@ re_scan:
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (func_idx == cur_func_idx) {
|
||||
if (func_idx == cur_func_idx + module->import_function_count) {
|
||||
WASMTableSeg *table_seg = module->table_segments;
|
||||
bool func_declared = false;
|
||||
uint32 j;
|
||||
|
@ -7598,8 +7598,7 @@ re_scan:
|
|||
if (table_seg->elem_type == VALUE_TYPE_FUNCREF
|
||||
&& wasm_elem_is_declarative(table_seg->mode)) {
|
||||
for (j = 0; j < table_seg->function_count; j++) {
|
||||
if (table_seg->func_indexes[j]
|
||||
== cur_func_idx) {
|
||||
if (table_seg->func_indexes[j] == func_idx) {
|
||||
func_declared = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -5188,14 +5188,10 @@ re_scan:
|
|||
loader_ctx->frame_csp->end_addr = p - 1;
|
||||
}
|
||||
else {
|
||||
/* end of function block, function will return,
|
||||
ignore the following bytecodes */
|
||||
p = p_end;
|
||||
|
||||
continue;
|
||||
/* end of function block, function will return */
|
||||
bh_assert(p == p_end);
|
||||
}
|
||||
|
||||
SET_CUR_BLOCK_STACK_POLYMORPHIC_STATE(false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5763,7 +5759,7 @@ re_scan:
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (func_idx == cur_func_idx) {
|
||||
if (func_idx == cur_func_idx + module->import_function_count) {
|
||||
WASMTableSeg *table_seg = module->table_segments;
|
||||
bool func_declared = false;
|
||||
uint32 j;
|
||||
|
@ -5773,8 +5769,7 @@ re_scan:
|
|||
if (table_seg->elem_type == VALUE_TYPE_FUNCREF
|
||||
&& wasm_elem_is_declarative(table_seg->mode)) {
|
||||
for (j = 0; j < table_seg->function_count; j++) {
|
||||
if (table_seg->func_indexes[j]
|
||||
== cur_func_idx) {
|
||||
if (table_seg->func_indexes[j] == func_idx) {
|
||||
func_declared = true;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user