diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-02-11 17:13:09 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-02-11 17:13:09 +0100 |
| commit | 394ccffc5a3f7a6fb791eaa87767cf1bba34199c (patch) | |
| tree | 590ed442c9f34d084b8282e4f10ad12e17d4262c | |
| parent | 6894b01b22e848b5fdbb2fafae88e9459232ced2 (diff) | |
| download | tools.nes-394ccffc5a3f7a6fb791eaa87767cf1bba34199c.tar.gz tools.nes-394ccffc5a3f7a6fb791eaa87767cf1bba34199c.zip | |
asan: Fix validation on indirect jumps
There were two bugs involved at the same time. First, for some reason,
the "matches" clause was negated, which defeats the purpose of the
check. This even resulted in a bad test run which was accepted because I
just did not caught it before.
Second, pure indirect addressing mode is only available for the "jmp"
instruction. Hence, there's no need for that "matches" at all, and even
less to filter that based on "jsr" which doesn't even implement this
addressing mode.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
| -rw-r--r-- | lib/xixanta/src/assembler.rs | 4 | ||||
| -rw-r--r-- | tests/expected/bare_accesses.txt | 1 |
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/xixanta/src/assembler.rs b/lib/xixanta/src/assembler.rs index 507f5e1..d5dc5fa 100644 --- a/lib/xixanta/src/assembler.rs +++ b/lib/xixanta/src/assembler.rs @@ -2749,9 +2749,7 @@ impl<'a> Assembler<'a> { expanded_from: self.macro_context.clone(), }); } - if !matches!(node.value.value.as_str(), "jmp" | "jsr") { - self.asan_check_arm(evaluated_node, &val)?; - } + self.asan_check_arm(evaluated_node, &val)?; Ok((AddressingMode::Indirect, val)) } }, diff --git a/tests/expected/bare_accesses.txt b/tests/expected/bare_accesses.txt index 676723f..35db410 100644 --- a/tests/expected/bare_accesses.txt +++ b/tests/expected/bare_accesses.txt @@ -1,5 +1,6 @@ warning: accessing a memory region without using a variable (bare_accesses.s: line 22) warning: accessing a memory region without a proper name ('whatever') (bare_accesses.s: line 23) warning: accessing a memory region without using a variable (bare_accesses.s: line 41) +warning: accessing a memory region without using a variable (bare_accesses.s: line 44) error: out of bounds memory access for 'zp_used' ($00-$01) (bare_accesses.s: line 27) error: out of bounds memory access for 'zp_used' ($00-$01) (bare_accesses.s: line 28) |
