Skip to content

Commit 33eff93

Browse files
authored
add validation for rec indices in aot loader (#4520)
1 parent aad1866 commit 33eff93

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/iwasm/aot/aot_loader.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,12 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
18051805
read_uint32(buf, buf_end, parent_type_idx);
18061806
read_uint16(buf, buf_end, rec_count);
18071807
read_uint16(buf, buf_end, rec_idx);
1808-
1808+
#if WASM_ENABLE_AOT_VALIDATOR != 0
1809+
if (rec_idx > i) {
1810+
set_error_buf(error_buf, error_buf_size, "invalid rec_idx");
1811+
goto fail;
1812+
}
1813+
#endif
18091814
if (type_flag == WASM_TYPE_FUNC) {
18101815
AOTFuncType *func_type;
18111816

0 commit comments

Comments
 (0)