fix(aot_emit_aot_file): prevent buffer emission for zero byte_count (#4095)

if using a debug building of wamrc to run spec test. there will be:
core/iwasm/compilation/aot_emit_aot_file.c:1794:13: runtime error: null pointer passed as argument 2, which is declared to never be null
This commit is contained in:
liang.he
2025-02-21 07:46:20 +08:00
committed by GitHub
parent ff10b86938
commit d0e2a7271c

View File

@ -1790,8 +1790,10 @@ aot_emit_mem_info(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
&init_datas[i]->offset))
return false;
EMIT_U32(init_datas[i]->byte_count);
if (init_datas[i]->byte_count) {
EMIT_BUF(init_datas[i]->bytes, init_datas[i]->byte_count);
}
}
if (offset - *p_offset != get_mem_info_size(comp_ctx, comp_data)) {
aot_set_last_error("emit memory info failed.");