Skip to content

Commit

Permalink
vm: fix broken stack guard in vm::exec()
Browse files Browse the repository at this point in the history
The symbol used in the stack guard and call stack push
was not actually initialized, causing a crash when creating
any function override.
  • Loading branch information
lmichaelis committed Nov 13, 2022
1 parent ce320ad commit 272c2a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)};
}
Expand Down

0 comments on commit 272c2a3

Please sign in to comment.