Refine aot stack overflow check and enhance wasm loader malformed checks (#248)
And separate global data from wasm memory instance
This commit is contained in:
@ -897,6 +897,15 @@ aot_call_indirect(WASMExecEnv *exec_env,
|
||||
void *attachment = NULL;
|
||||
char buf[128];
|
||||
|
||||
/* this function is called from native code, so exec_env->handle and
|
||||
exec_env->native_stack_boundary must have been set, we don't set
|
||||
it again */
|
||||
|
||||
if ((uint8*)&module_inst < exec_env->native_stack_boundary) {
|
||||
aot_set_exception_with_id(module_inst, EXCE_NATIVE_STACK_OVERFLOW);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (table_elem_idx >= table_size) {
|
||||
aot_set_exception_with_id(module_inst, EXCE_UNDEFINED_ELEMENT);
|
||||
return false;
|
||||
@ -941,15 +950,6 @@ aot_call_indirect(WASMExecEnv *exec_env,
|
||||
}
|
||||
}
|
||||
|
||||
/* this function is called from native code, so exec_env->handle and
|
||||
exec_env->native_stack_boundary must have been set, we don't set
|
||||
it again */
|
||||
|
||||
if ((uint8*)&module_inst < exec_env->native_stack_boundary) {
|
||||
aot_set_exception_with_id(module_inst, EXCE_NATIVE_STACK_OVERFLOW);
|
||||
return false;
|
||||
}
|
||||
|
||||
return wasm_runtime_invoke_native(exec_env, func_ptr,
|
||||
func_type, signature, attachment,
|
||||
argv, argc, argv);
|
||||
|
||||
Reference in New Issue
Block a user