From 272c2a33f9bd7bb97d88a9b4b19871b16d37ce4b Mon Sep 17 00:00:00 2001 From: Luis Michaelis Date: Wed, 9 Nov 2022 15:23:48 +0100 Subject: [PATCH] vm: fix broken stack guard in `vm::exec()` The symbol used in the stack guard and call stack push was not actually initialized, causing a crash when creating any function override. --- source/vm.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/vm.cc b/source/vm.cc index 9b08c232..d0f5730d 100644 --- a/source/vm.cc +++ b/source/vm.cc @@ -194,6 +194,7 @@ namespace phoenix { return false; case opcode::bl: { // Check if the function is overridden and if it is, call the resulting external. + sym = find_symbol_by_address(instr.address); auto cb = _m_function_overrides.find(instr.address); if (cb != _m_function_overrides.end()) { // Guard against exceptions during external invocation. @@ -206,7 +207,6 @@ namespace phoenix { // The stack is left intact. guard.inhibit(); } else { - sym = find_symbol_by_address(instr.address); if (sym == nullptr) { throw vm_exception {"bl: no symbol found for address " + std::to_string(instr.address)}; }