From 89383963b118a0d522eb302ffe5eb9941bfd21f0 Mon Sep 17 00:00:00 2001 From: Chris Mountford Date: Thu, 19 Dec 2024 13:52:06 +1100 Subject: [PATCH] fix bug: off-by-1 reported offset on failure --- client/src/machine/asm/Disassembler.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/machine/asm/Disassembler.ts b/client/src/machine/asm/Disassembler.ts index 2516fd0..3196f38 100644 --- a/client/src/machine/asm/Disassembler.ts +++ b/client/src/machine/asm/Disassembler.ts @@ -237,10 +237,11 @@ class Disassembler { * @private */ private eatByte(): number { - const value = this.fb.read8(this.currentIndex++); // side effect + const value = this.fb.read8(this.currentIndex); // side effect if (typeof value === "undefined") { throw Error(`Illegal state, no byte at index ${this.currentIndex}`); } else { + this.currentIndex++; return (value & 0xff); } }