Skip to content

Commit 52d3452

Browse files
committed
Guard against out-of-bounds jumps in spesh arg guard program.
This seems to be what sometimes happens on arm builds for our debian package, and hitting this oops should be better than running into an endless do-nothing loop.
1 parent f468076 commit 52d3452

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/spesh/arg_guard.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,13 @@ MVMint32 MVM_spesh_arg_guard_run(MVMThreadContext *tc, MVMSpeshArgGuard *ag,
510510
break;
511511
case MVM_SPESH_GUARD_OP_RESULT:
512512
return agn->result;
513+
default:
514+
MVM_oops(tc, "Unknown spesh arg guard opcode %d reached", agn->op);
513515
}
514-
} while (current_node != 0);
516+
} while (current_node != 0 && current_node < ag->num_nodes);
517+
if (current_node >= ag->num_nodes) {
518+
MVM_oops(tc, "Spesh arg guard program jumped out of bounds: index %u is above %u", current_node, ag->num_nodes);
519+
}
515520
return -1;
516521
}
517522

0 commit comments

Comments
 (0)