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à --- scripts/test-e2e.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'scripts') diff --git a/scripts/test-e2e.sh b/scripts/test-e2e.sh index 0cf37f0..17766a4 100755 --- a/scripts/test-e2e.sh +++ b/scripts/test-e2e.sh @@ -351,6 +351,25 @@ exit_code=$((exit_code + $?)) diff tests/out/misc-foo.txt tests/expected/runrom/misc-foo.txt exit_code=$((exit_code + $?)) +echo "test: runrom => overflows.nes" +./target/debug/nasm -Werror --asan --write-info --out tests/out/overflows.nes tests/runrom/overflows.s + +./target/debug/runrom --nasm .nasm/ --dump-memory --function tests/out/overflows.nes &> tests/out/overflow-reset.txt +diff tests/out/overflow-reset.txt tests/expected/runrom/overflow-reset.txt +exit_code=$((exit_code + $?)) + +./target/debug/runrom --nasm .nasm/ --dump-memory --function --start overflow_on_arithmetics tests/out/overflows.nes &> tests/out/overflow-arithmetics.txt +diff tests/out/overflow-arithmetics.txt tests/expected/runrom/overflow-arithmetics.txt +exit_code=$((exit_code + $?)) + +./target/debug/runrom --nasm .nasm/ --dump-memory --function --start stack_underflow tests/out/overflows.nes &> tests/out/overflow-stack.txt +diff tests/out/overflow-stack.txt tests/expected/runrom/overflow-stack.txt +exit_code=$((exit_code + $?)) + +./target/debug/runrom --nasm .nasm/ --dump-memory --function --start bad_rom_data_indexing tests/out/overflows.nes &> tests/out/overflow-data-indexing.txt +diff tests/out/overflow-data-indexing.txt tests/expected/runrom/overflow-data-indexing.txt +exit_code=$((exit_code + $?)) + ## # vnf-tests -- cgit v1.2.3