Skip to content

Commit 95f7717

Browse files
authored
aot loader: Add more checks in load_native_symbol_section() (#3559)
Fix issue reported by Oss-fuzz test (#69675).
1 parent 4c2af25 commit 95f7717

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

core/iwasm/aot/aot_loader.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,15 +660,18 @@ load_native_symbol_section(const uint8 *buf, const uint8 *buf_end,
660660
read_uint32(p, p_end, cnt);
661661

662662
if (cnt > 0) {
663-
module->native_symbol_list = wasm_runtime_malloc(cnt * sizeof(void *));
663+
uint64 list_size = cnt * (uint64)sizeof(void *);
664+
module->native_symbol_list =
665+
loader_malloc(list_size, error_buf, error_buf_size);
664666
if (module->native_symbol_list == NULL) {
665-
set_error_buf(error_buf, error_buf_size,
666-
"malloc native symbol list failed");
667667
goto fail;
668668
}
669669

670670
for (i = cnt - 1; i >= 0; i--) {
671671
read_string(p, p_end, symbol);
672+
if (!strlen(symbol))
673+
continue;
674+
672675
if (!strncmp(symbol, "f32#", 4) || !strncmp(symbol, "i32#", 4)) {
673676
uint32 u32;
674677
/* Resolve the raw int bits of f32 const */

0 commit comments

Comments
 (0)