fix: handle null exec_env in instruction metering checks

This commit is contained in:
Alix ANNERAUD 2025-03-02 22:14:30 +01:00
parent ad6ba3d7cf
commit 76392b546b
2 changed files with 8 additions and 2 deletions

View File

@ -1623,7 +1623,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 cache_index, type_index, param_cell_num, cell_num; uint32 cache_index, type_index, param_cell_num, cell_num;
#if WASM_INSTRUCTION_METERING != 0 #if WASM_INSTRUCTION_METERING != 0
int instructions_left = exec_env->instructions_to_execute; int instructions_left = -1;
if (exec_env) {
instructions_left = exec_env->instructions_to_execute;
}
#endif #endif
#if WASM_ENABLE_EXCE_HANDLING != 0 #if WASM_ENABLE_EXCE_HANDLING != 0

View File

@ -1524,7 +1524,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint8 opcode = 0, local_type, *global_addr; uint8 opcode = 0, local_type, *global_addr;
#if WASM_INSTRUCTION_METERING != 0 #if WASM_INSTRUCTION_METERING != 0
int instructions_left = exec_env->instructions_to_execute; int instructions_left = -1;
if (exec_env) {
instructions_left = exec_env->instructions_to_execute;
}
#endif #endif
#if !defined(OS_ENABLE_HW_BOUND_CHECK) \ #if !defined(OS_ENABLE_HW_BOUND_CHECK) \
|| WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS == 0 || WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS == 0