add validation for rec indices in aot loader (#4520)

This commit is contained in:
Zhenwei Jin 2025-08-01 08:45:57 +08:00 committed by GitHub
parent aad1866260
commit 33eff933c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1805,7 +1805,12 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
read_uint32(buf, buf_end, parent_type_idx); read_uint32(buf, buf_end, parent_type_idx);
read_uint16(buf, buf_end, rec_count); read_uint16(buf, buf_end, rec_count);
read_uint16(buf, buf_end, rec_idx); read_uint16(buf, buf_end, rec_idx);
#if WASM_ENABLE_AOT_VALIDATOR != 0
if (rec_idx > i) {
set_error_buf(error_buf, error_buf_size, "invalid rec_idx");
goto fail;
}
#endif
if (type_flag == WASM_TYPE_FUNC) { if (type_flag == WASM_TYPE_FUNC) {
AOTFuncType *func_type; AOTFuncType *func_type;