Skip to content

Commit

Permalink
Fix: out of range fidx in invoke message
Browse files Browse the repository at this point in the history
  • Loading branch information
tolauwae committed Jan 4, 2023
1 parent cde6b37 commit bdb533f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Debug/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ uint8_t *Debugger::findOpcode(Module *m, Block *block) {
void Debugger::handleInvoke(Module *m, uint8_t *interruptData) {
uint32_t fidx = read_L32(&interruptData);

if (fidx < 0 || fidx >= m->function_count) {
debug("no function available for fidx %" PRIi32 "\n", fidx);
return;
}

Type func = *m->functions[fidx].type;
StackValue *args = readArgs(func, interruptData);

Expand Down
2 changes: 1 addition & 1 deletion src/Debug/debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Debugger {

//// Handle REPL interrupts

void handleInvoke(Module *m, uint8_t *interruptData);
static void handleInvoke(Module *m, uint8_t *interruptData);

//// Handle Interrupt Types

Expand Down

0 comments on commit bdb533f

Please sign in to comment.