mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-14 13:41:31 +00:00
aot loader: Add more checks in load_native_symbol_section()
(#3559)
Fix issue reported by Oss-fuzz test (#69675).
This commit is contained in:
parent
4c2af25aff
commit
95f7717555
|
@ -660,15 +660,18 @@ load_native_symbol_section(const uint8 *buf, const uint8 *buf_end,
|
||||||
read_uint32(p, p_end, cnt);
|
read_uint32(p, p_end, cnt);
|
||||||
|
|
||||||
if (cnt > 0) {
|
if (cnt > 0) {
|
||||||
module->native_symbol_list = wasm_runtime_malloc(cnt * sizeof(void *));
|
uint64 list_size = cnt * (uint64)sizeof(void *);
|
||||||
|
module->native_symbol_list =
|
||||||
|
loader_malloc(list_size, error_buf, error_buf_size);
|
||||||
if (module->native_symbol_list == NULL) {
|
if (module->native_symbol_list == NULL) {
|
||||||
set_error_buf(error_buf, error_buf_size,
|
|
||||||
"malloc native symbol list failed");
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = cnt - 1; i >= 0; i--) {
|
for (i = cnt - 1; i >= 0; i--) {
|
||||||
read_string(p, p_end, symbol);
|
read_string(p, p_end, symbol);
|
||||||
|
if (!strlen(symbol))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!strncmp(symbol, "f32#", 4) || !strncmp(symbol, "i32#", 4)) {
|
if (!strncmp(symbol, "f32#", 4) || !strncmp(symbol, "i32#", 4)) {
|
||||||
uint32 u32;
|
uint32 u32;
|
||||||
/* Resolve the raw int bits of f32 const */
|
/* Resolve the raw int bits of f32 const */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user