wasm loader: Reject v128 for interpreters (#3611)

discussed in:
https://github.com/bytecodealliance/wasm-micro-runtime/pull/3592
This commit is contained in:
YAMAMOTO Takashi
2024-07-10 14:50:52 +09:00
committed by GitHub
parent 2cf48c8b9f
commit 1b1ec715e9
4 changed files with 34 additions and 13 deletions

View File

@ -91,7 +91,8 @@ is_64bit_type(uint8 type)
static bool
is_byte_a_type(uint8 type)
{
return is_valid_value_type(type) || (type == VALUE_TYPE_VOID);
return is_valid_value_type_for_interpreter(type)
|| (type == VALUE_TYPE_VOID);
}
static void
@ -568,7 +569,7 @@ load_type_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
type->types[param_count + j] = read_uint8(p);
}
for (j = 0; j < param_count + result_count; j++) {
bh_assert(is_valid_value_type(type->types[j]));
bh_assert(is_valid_value_type_for_interpreter(type->types[j]));
}
param_cell_num = wasm_get_cell_num(type->types, param_count);
@ -1218,7 +1219,7 @@ load_function_section(const uint8 *buf, const uint8 *buf_end,
CHECK_BUF(p_code, buf_code_end, 1);
/* 0x7F/0x7E/0x7D/0x7C */
type = read_uint8(p_code);
bh_assert(is_valid_value_type(type));
bh_assert(is_valid_value_type_for_interpreter(type));
for (k = 0; k < sub_local_count; k++) {
func->local_types[local_type_index++] = type;
}
@ -6828,7 +6829,7 @@ re_scan:
CHECK_BUF(p, p_end, 1);
ref_type = read_uint8(p);
if (!is_valid_value_type(ref_type)) {
if (!is_valid_value_type_for_interpreter(ref_type)) {
set_error_buf(error_buf, error_buf_size,
"unknown value type");
goto fail;