aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/runtime.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/runtime.c b/src/runtime.c
index 241d664..c2c793c 100644
--- a/src/runtime.c
+++ b/src/runtime.c
@@ -129,7 +129,8 @@ void vm_execute_all(vm_t *vm)
size_t cycles = 0;
size_t prev_sptr = 0;
#endif
- while (program->instructions[program->ptr].opcode != OP_HALT)
+ while (program->instructions[program->ptr].opcode != OP_HALT &&
+ program->ptr < program->max)
{
#if VERBOSE >= 1
fprintf(stdout, "[vm_execute_all]: Trace(Cycle %lu)\n", cycles);