diff --git a/core/iwasm/aot/aot_loader.c b/core/iwasm/aot/aot_loader.c index 96ea02f8e..633e99639 100644 --- a/core/iwasm/aot/aot_loader.c +++ b/core/iwasm/aot/aot_loader.c @@ -3343,6 +3343,6 @@ aot_get_custom_section(AOTModule *module, const char *name, uint32 *len) section = section->next; } - return false; + return NULL; } #endif /* end of WASM_ENABLE_LOAD_CUSTOM_SECTION */ diff --git a/core/iwasm/compilation/aot_emit_aot_file.c b/core/iwasm/compilation/aot_emit_aot_file.c index bdfa5df0e..76e0bc723 100644 --- a/core/iwasm/compilation/aot_emit_aot_file.c +++ b/core/iwasm/compilation/aot_emit_aot_file.c @@ -1304,7 +1304,7 @@ get_custom_sections_size(AOTCompContext *comp_ctx, AOTCompData *comp_data) size = align_uint(size, 4); /* section id + section size + sub section id */ size += (uint32)sizeof(uint32) * 3; - /* section name, null terminated string */ + /* section name and len */ size += get_string_size(comp_ctx, section_name); /* section content */ size += length; diff --git a/core/iwasm/include/wasm_export.h b/core/iwasm/include/wasm_export.h index 0c3032db3..9b1481d72 100644 --- a/core/iwasm/include/wasm_export.h +++ b/core/iwasm/include/wasm_export.h @@ -1060,7 +1060,8 @@ wasm_runtime_dump_call_stack(wasm_exec_env_t exec_env); * @param name name of the custom section * @param len return the length of the content if found * - * @return Custom section content (including the name) if found, NULL otherwise + * @return Custom section content (not including the name length + * and name string) if found, NULL otherwise */ WASM_RUNTIME_API_EXTERN const uint8_t * wasm_runtime_get_custom_section(wasm_module_t const module_comm,