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:
@ -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.");
|
||||
|
||||
Reference in New Issue
Block a user