Fix app heap corrupted unchecked issue (#788)

Check whether app heap is corrupted in gc_migrate() and gci_dump(),
and handle the failures in wasm/aot_enlarge_memory().
This commit is contained in:
Wenyong Huang
2021-10-15 20:56:41 +08:00
committed by GitHub
parent a121e45a1e
commit 3dff80157b
7 changed files with 75 additions and 21 deletions

View File

@ -4211,3 +4211,14 @@ fail:
wasm_runtime_free(results);
return ret;
}
void
wasm_runtime_show_app_heap_corrupted_prompt()
{
LOG_ERROR("Error: app heap is corrupted, if the wasm file "
"is compiled by wasi-sdk-12.0 or higher version, "
"please add -Wl,--export=malloc -Wl,--export=free "
"to export malloc and free functions. If it is "
"compiled by asc, please add --exportRuntime to "
"export the runtime helpers.");
}

View File

@ -839,6 +839,9 @@ wasm_runtime_invoke_c_api_native(WASMModuleInstanceCommon *module_inst,
uint32 argc, uint32 *argv, bool with_env,
void *wasm_c_api_env);
void
wasm_runtime_show_app_heap_corrupted_prompt();
#ifdef __cplusplus
}
#endif