Fix table idx resolving in op call_indirect/return_call_indirect (#3726)

The table index in the call_indirect/return_call_indirect opcode should be
one byte 0x00 when ref-types/GC isn't enabled, and should be treated as
leb u32 when ref-types/GC is enabled.

And make aot compiler bail out if ref-types/GC is disabled by command line
argument while ref-types instructions are used.
This commit is contained in:
Wenyong Huang
2024-08-19 10:57:36 +08:00
committed by GitHub
parent 88caa0c53a
commit 97c95a2e2f
4 changed files with 30 additions and 8 deletions

View File

@ -3501,8 +3501,11 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache,
case WASM_OP_RETURN_CALL_INDIRECT:
#endif
skip_leb_uint32(p, p_end); /* typeidx */
CHECK_BUF(p, p_end, 1);
#if WASM_ENABLE_REF_TYPES != 0
skip_leb_uint32(p, p_end); /* tableidx */
#else
u8 = read_uint8(p); /* 0x00 */
#endif
break;
#if WASM_ENABLE_EXCE_HANDLING != 0