Skip to content

Commit d7b6bc5

Browse files
authored
Add a watchdog to prevent the similar crash in AOT mode (#4625)
1 parent df90804 commit d7b6bc5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/iwasm/aot/aot_runtime.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ set_error_buf_v(char *error_buf, uint32 error_buf_size, const char *format, ...)
114114
}
115115
}
116116

117+
static void
118+
aot_unlinked_import_func_trap(WASMExecEnv *exec_env)
119+
{
120+
AOTModuleInstance *module_inst = (AOTModuleInstance *)exec_env->module_inst;
121+
aot_set_exception_with_id(module_inst, EXCE_CALL_UNLINKED_IMPORT_FUNC);
122+
}
123+
117124
static void *
118125
runtime_malloc(uint64 size, char *error_buf, uint32 error_buf_size)
119126
{
@@ -1397,6 +1404,7 @@ init_func_ptrs(AOTModuleInstance *module_inst, AOTModule *module,
13971404
* Debugging: Check if the import is resolved at link time */
13981405
LOG_WARNING("warning: failed to link import function (%s, %s)",
13991406
module_name, field_name);
1407+
*func_ptrs = (void *)aot_unlinked_import_func_trap;
14001408
}
14011409
}
14021410

0 commit comments

Comments
 (0)