aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-10-09 21:45:05 +0200
committerMiquel Sabaté Solà <mssola@mssola.com>2026-10-09 21:45:05 +0200
commitf6df4314945c1d37d314a7c88553b97b23c748e9 (patch)
tree20e71c89c25f469a83c52528dfdfe0ed71a8c3e1 /scripts
parentaa5174fc055dc66e78a8aa7030c018e43cf588a1 (diff)
downloadtools.nes-f6df4314945c1d37d314a7c88553b97b23c748e9.tar.gz
tools.nes-f6df4314945c1d37d314a7c88553b97b23c748e9.zip
vnf,runrom: detect bad data access
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à <mssola@mssola.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/test-e2e.sh19
1 files changed, 19 insertions, 0 deletions
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