From ec935330d4518829d01bbdf5670c4569fa07a567 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 15 Dec 2025 22:15:09 +0100 Subject: Allow constants in asan:reserve statements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way, if you define a constant like: MY_BUFFER_LEN_IN_BYTES = $10 You can then declare your buffer like so: zp_buffer = $00 ; asan:reserve MY_BUFFER_LEN_IN_BYTES And then further in the code you can rely on just using the constant for bound checking, and then the address sanitizer will check on bound checks via static analysis as well. Signed-off-by: Miquel Sabaté Solà --- scripts/test-e2e.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') diff --git a/scripts/test-e2e.sh b/scripts/test-e2e.sh index 2d9370a..c9821c9 100755 --- a/scripts/test-e2e.sh +++ b/scripts/test-e2e.sh @@ -66,6 +66,11 @@ echo "test: custom => variable_names.nes" diff tests/out/variable_names.txt tests/expected/variable_names.txt exit_code=$((exit_code + $?)) +echo "test: custom => asan_reserve_constant.nes" +./target/debug/nasm -c empty --asan tests/asan_reserve_constant.s 2>tests/out/asan_reserve_constant.txt +diff tests/out/asan_reserve_constant.txt tests/expected/asan_reserve_constant.txt +exit_code=$((exit_code + $?)) + ## # code.nes -- cgit v1.2.3