mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-09-05 17:32:26 +00:00
add rec idx and rec count validation in aot loader (#4555)
Signed-off-by: zhenweijin <zhenwei.jin@intel.com>
This commit is contained in:
parent
d0c636bd80
commit
ab2ff4a56d
|
@ -1807,8 +1807,12 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
|
||||||
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 WASM_ENABLE_AOT_VALIDATOR != 0
|
||||||
if (rec_idx > i) {
|
if (rec_count > module->type_count) {
|
||||||
set_error_buf(error_buf, error_buf_size, "invalid rec_idx");
|
set_error_buf(error_buf, error_buf_size, "invalid rec count");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
if (rec_idx > i || rec_idx >= rec_count) {
|
||||||
|
set_error_buf(error_buf, error_buf_size, "invalid rec idx");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (parent_type_idx >= i) {
|
if (parent_type_idx >= i) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user