From f6df4314945c1d37d314a7c88553b97b23c748e9 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 9 Oct 2026 21:45:05 +0200 Subject: vnf,runrom: detect bad data access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This includes detection for: - Stack underflows (it was theoretically already there but it had never been properly tested). - Load/store out of bounds for a given variable known via the .nasm/ directory. - Load out of bounds on a set of data referenced via a raw label (see commit aa5174fc055d ("xixanta: Add an hint for the ending of data labels")). Signed-off-by: Miquel Sabaté Solà --- tests/expected/runrom/overflow-data-indexing.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/expected/runrom/overflow-data-indexing.txt (limited to 'tests/expected/runrom/overflow-data-indexing.txt') diff --git a/tests/expected/runrom/overflow-data-indexing.txt b/tests/expected/runrom/overflow-data-indexing.txt new file mode 100644 index 0000000..469a265 --- /dev/null +++ b/tests/expected/runrom/overflow-data-indexing.txt @@ -0,0 +1,10 @@ + PC: $801B, cycles: 7, registers: [a: $00, x: $00, y: $00, sp: $FD], status: ----I-- +ldx #$00 PC: $801D, cycles: 9, registers: [a: $00, x: $00, y: $00, sp: $FD], status: ----IZ- +lda $8028, x PC: $8020, cycles: 13, registers: [a: $00, x: $00, y: $00, sp: $FD], status: ----IZ- +clc PC: $8021, cycles: 15, registers: [a: $00, x: $00, y: $00, sp: $FD], status: ----IZ- +adc #$04 PC: $8023, cycles: 17, registers: [a: $04, x: $00, y: $00, sp: $FD], status: ----I-- +tax PC: $8024, cycles: 19, registers: [a: $04, x: $04, y: $00, sp: $FD], status: ----I-- + +@: +lda $8028, x PC: $8024, cycles: 19, registers: [a: $04, x: $04, y: $00, sp: $FD], status: ----I-- +error: out of bounds: indexed access to $802C falls out of 'bad_rom_data_indexing::data' ($8028-$802C; bounded inclusively below and exclusively above) -- cgit v1.2.3