From cbb6d033375a07966ec218863e6c18cb55574e3e Mon Sep 17 00:00:00 2001 From: Liu Jia Date: Wed, 13 Aug 2025 11:05:06 +0800 Subject: [PATCH] add validtion for parent_type_idx (#4550) --- core/iwasm/aot/aot_loader.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/iwasm/aot/aot_loader.c b/core/iwasm/aot/aot_loader.c index 5fdd34ed1..b36d5aa3a 100644 --- a/core/iwasm/aot/aot_loader.c +++ b/core/iwasm/aot/aot_loader.c @@ -1811,6 +1811,12 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module, set_error_buf(error_buf, error_buf_size, "invalid rec_idx"); goto fail; } + if (parent_type_idx >= i) { + set_error_buf( + error_buf, error_buf_size, + "parent type index must be smaller than current type index"); + goto fail; + } #endif if (type_flag == WASM_TYPE_FUNC) { AOTFuncType *func_type;