Skip to content

Commit

Permalink
fix(aot_emit_aot_file): prevent buffer emission for zero byte_count (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
lum1n0us authored Feb 20, 2025
1 parent ff10b86 commit d0e2a72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/iwasm/compilation/aot_emit_aot_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,9 @@ 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);
EMIT_BUF(init_datas[i]->bytes, 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)) {
Expand Down

0 comments on commit d0e2a72

Please sign in to comment.