Skip to content

Commit 378320b

Browse files
authored
loader: add type index checking (#4521)
1 parent 33eff93 commit 378320b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/iwasm/aot/aot_loader.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,8 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
17861786

17871787
read_uint32(buf, buf_end, j);
17881788
#if WASM_ENABLE_AOT_VALIDATOR != 0
1789-
if (j >= module->type_count) {
1789+
/* an equivalence type should be before the type it refers to */
1790+
if (j > i) {
17901791
set_error_buf(error_buf, error_buf_size, "invalid type index");
17911792
goto fail;
17921793
}

0 commit comments

Comments
 (0)