Append \0 to every name string in aot name section (#3249)

Since strings in .name section in .wasm is not c-style, need to append
a `\0` to each string in .name section in AOT file when emitting.
This commit is contained in:
liang.he
2024-03-26 14:27:20 +08:00
committed by GitHub
parent d8d8f8ce04
commit 498eb5d54a
3 changed files with 23 additions and 9 deletions

View File

@ -1942,7 +1942,7 @@ load_user_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
bh_assert(name_len > 0 && p + name_len <= p_end);
#if WASM_ENABLE_CUSTOM_NAME_SECTION != 0
if (memcmp(p, "name", 4) == 0) {
if (name_len == 4 && memcmp(p, "name", 4) == 0) {
p += name_len;
handle_name_section(p, p_end, module, is_load_from_file_buf, error_buf,
error_buf_size);