Skip to content

Commit

Permalink
Fix null pointer access in fast-interp when configurable soft bound c…
Browse files Browse the repository at this point in the history
…heck is enabled (#3150)

The wasm_interp_call_func_bytecode is called for the first time with the empty
module/exec_env to generate a global_handle_table. Before that happens though,
the function checks if the module instance has bounds check enabled. Because
the module instance is null, the program crashes. This PR added an extra check to
prevent the crashes.
  • Loading branch information
loganek authored Feb 14, 2024
1 parent 12f834a commit e792c35
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/iwasm/common/wasm_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ static inline bool
is_bounds_checks_enabled(WASMModuleInstanceCommon *module_inst)
{
#if WASM_CONFIGURABLE_BOUNDS_CHECKS != 0
if (!module_inst) {
return true;
}

return wasm_runtime_is_bounds_checks_enabled(module_inst);
#else
return true;
Expand Down

0 comments on commit e792c35

Please sign in to comment.