From 789016a3439781eca20f3fca47e62dd8f2d2ea7b Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 22 Oct 2023 21:39:32 +0100 Subject: Fix bug where negative opcodes lead to invalid bytecode parsing --- src/inst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/inst.c b/src/inst.c index a935d8a..59ca795 100644 --- a/src/inst.c +++ b/src/inst.c @@ -323,7 +323,7 @@ inst_t inst_read_bytecode(darr_t *darr) return (inst_t){0}; inst_t inst = {0}; opcode_t opcode = darr->data[darr->used++]; - if (opcode > OP_HALT || opcode == NUMBER_OF_OPCODES) + if (opcode > OP_HALT || opcode == NUMBER_OF_OPCODES || opcode < OP_NOOP) // Translate to NOOP return inst; // Read operands -- cgit v1.2.3-13-gbd6f