Check passive mode in fast-jit table.init (#3031)

Reported in https://github.com/bytecodealliance/wasm-micro-runtime/issues/3021.
This commit is contained in:
Wenyong Huang 2024-01-16 21:55:10 +08:00 committed by GitHub
parent bb053e3a2d
commit b3aaf2abc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,6 +112,9 @@ wasm_init_table(WASMModuleInstance *inst, uint32 tbl_idx, uint32 elem_idx,
if (bh_bitmap_get_bit(inst->e->common.elem_dropped, elem_idx))
goto out_of_bounds;
if (!wasm_elem_is_passive(inst->module->table_segments[elem_idx].mode))
goto out_of_bounds;
bh_memcpy_s((uint8 *)tbl + offsetof(WASMTableInstance, elems)
+ dst_offset * sizeof(uint32),
(uint32)((tbl_sz - dst_offset) * sizeof(uint32)),