diff --git a/core/iwasm/aot/aot_loader.c b/core/iwasm/aot/aot_loader.c index d53f7c52d..b0f155665 100644 --- a/core/iwasm/aot/aot_loader.c +++ b/core/iwasm/aot/aot_loader.c @@ -1786,7 +1786,8 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module, read_uint32(buf, buf_end, j); #if WASM_ENABLE_AOT_VALIDATOR != 0 - if (j >= module->type_count) { + /* an equivalence type should be before the type it refers to */ + if (j > i) { set_error_buf(error_buf, error_buf_size, "invalid type index"); goto fail; }