Validate func type in aot loader (#3535)

Fix issue reported by Oss-fuzz test (#69629).
This commit is contained in:
liang.he
2024-06-18 14:23:32 +08:00
committed by GitHub
parent f096b2fa38
commit c19bc95391
5 changed files with 66 additions and 46 deletions

View File

@ -1684,6 +1684,9 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
func_type->ref_type_map_count = ref_type_map_count;
if (!is_valid_func_type(func_type))
goto fail;
param_cell_num = wasm_get_cell_num(func_type->types, param_count);
ret_cell_num =
wasm_get_cell_num(func_type->types + param_count, result_count);
@ -1988,6 +1991,9 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
func_types[i]->result_count = (uint16)result_count;
read_byte_array(buf, buf_end, func_types[i]->types, (uint32)size1);
if (!is_valid_func_type(func_types[i]))
goto fail;
param_cell_num = wasm_get_cell_num(func_types[i]->types, param_count);
ret_cell_num =
wasm_get_cell_num(func_types[i]->types + param_count, result_count);