Fix read and validation of misc/simd/atomic sub opcodes (#3115)
The format of sub opcodes after misc, simd and atomic prefix is leb u32. The issue was found in #2921.
This commit is contained in:
@ -3511,6 +3511,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||
uint32 opcode1;
|
||||
|
||||
read_leb_uint32(frame_ip, frame_ip_end, opcode1);
|
||||
/* opcode1 was checked in loader and is no larger than
|
||||
UINT8_MAX */
|
||||
opcode = (uint8)opcode1;
|
||||
|
||||
switch (opcode) {
|
||||
@ -3843,8 +3845,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||
HANDLE_OP(WASM_OP_ATOMIC_PREFIX)
|
||||
{
|
||||
uint32 offset = 0, align, addr;
|
||||
uint32 opcode1;
|
||||
|
||||
opcode = *frame_ip++;
|
||||
read_leb_uint32(frame_ip, frame_ip_end, opcode1);
|
||||
/* opcode1 was checked in loader and is no larger than
|
||||
UINT8_MAX */
|
||||
opcode = (uint8)opcode1;
|
||||
|
||||
if (opcode != WASM_OP_ATOMIC_FENCE) {
|
||||
read_leb_uint32(frame_ip, frame_ip_end, align);
|
||||
|
||||
Reference in New Issue
Block a user