Wasm loader enhancement: check code size in code entry (#3892)
add wasm loader check: in code entry, the code size should match the size of vec(locals) + expr, and expr should end with opcode end
This commit is contained in:
@ -1183,6 +1183,8 @@ load_function_section(const uint8 *buf, const uint8 *buf_end,
|
||||
local_count += sub_local_count;
|
||||
}
|
||||
|
||||
bh_assert(p_code_end > p_code && *(p_code_end - 1) == WASM_OP_END);
|
||||
|
||||
/* Alloc memory, layout: function structure + local types */
|
||||
code_size = (uint32)(p_code_end - p_code);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user