From a382a02ea98e9287b03fc3abf2b724f953ef9ee9 Mon Sep 17 00:00:00 2001 From: FromLiQg <56512053+FromLiQg@users.noreply.github.com> Date: Fri, 19 Aug 2022 12:56:24 +0800 Subject: [PATCH] Fix wasm_type_equal check in wasm_mini_loader.c (#1394) Fix wasm_type_equal check error in wasm_mini_loader.c: wasm_type_equal(type, j) -> wasm_type_equal(type, module->types[j]) And remove unused comments in aot_runtime.h --- core/iwasm/aot/aot_runtime.h | 10 ---------- core/iwasm/interpreter/wasm_mini_loader.c | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/core/iwasm/aot/aot_runtime.h b/core/iwasm/aot/aot_runtime.h index f9823896..14e037e7 100644 --- a/core/iwasm/aot/aot_runtime.h +++ b/core/iwasm/aot/aot_runtime.h @@ -624,16 +624,6 @@ aot_get_native_addr_range(AOTModuleInstance *module_inst, uint8 *native_ptr, bool aot_enlarge_memory(AOTModuleInstance *module_inst, uint32 inc_page_count); -/** - * Compare whether two wasm types are equal according to the indexs - * - * @param module_inst the AOT module instance - * @param type1_idx index of the first wasm type - * @param type2_idx index of the second wasm type - * - * @return true if equal, false otherwise - */ - /** * Invoke native function from aot code */ diff --git a/core/iwasm/interpreter/wasm_mini_loader.c b/core/iwasm/interpreter/wasm_mini_loader.c index c7c83d22..3ac80b7b 100644 --- a/core/iwasm/interpreter/wasm_mini_loader.c +++ b/core/iwasm/interpreter/wasm_mini_loader.c @@ -411,7 +411,7 @@ load_type_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module, /* If there is already a same type created, use it instead */ for (j = 0; j < i; ++j) { - if (wasm_type_equal(type, j)) { + if (wasm_type_equal(type, module->types[j])) { bh_assert(module->types[j]->ref_count != UINT16_MAX); destroy_wasm_type(type); module->types[i] = module->types[j];