Skip to content

Commit bdb533f

Browse files
committed
Fix: out of range fidx in invoke message
1 parent cde6b37 commit bdb533f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Debug/debugger.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,11 @@ uint8_t *Debugger::findOpcode(Module *m, Block *block) {
357357
void Debugger::handleInvoke(Module *m, uint8_t *interruptData) {
358358
uint32_t fidx = read_L32(&interruptData);
359359

360+
if (fidx < 0 || fidx >= m->function_count) {
361+
debug("no function available for fidx %" PRIi32 "\n", fidx);
362+
return;
363+
}
364+
360365
Type func = *m->functions[fidx].type;
361366
StackValue *args = readArgs(func, interruptData);
362367

src/Debug/debugger.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class Debugger {
9999

100100
//// Handle REPL interrupts
101101

102-
void handleInvoke(Module *m, uint8_t *interruptData);
102+
static void handleInvoke(Module *m, uint8_t *interruptData);
103103

104104
//// Handle Interrupt Types
105105

0 commit comments

Comments
 (0)