commit 8cda84c0798d1401fa706f0c470dc5d53f972ed9 parent 3cc7e8abc015c3a1cf5c9506be0c740924aa7a92 Author: Jared Tobin <jared@jtobin.io> Date: Tue, 10 Feb 2026 12:49:43 +0400 fix: parser and taint analysis bugs - Parse symbol addends (e.g., @PAGE+2) in symbol references - Reorder Parser.hs type alias for clarity Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Diffstat:
| M | lib/Audit/AArch64/Parser.hs | | | 13 | ++++++++++++- |
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/lib/Audit/AArch64/Parser.hs b/lib/Audit/AArch64/Parser.hs @@ -397,7 +397,18 @@ pSymbolSuffix :: Parser Text pSymbolSuffix = do void (char '@') suf <- takeWhile1P Nothing isAlphaNum - pure (T.cons '@' suf) + -- Optional addend like +2 or -3 + addend <- optional pAddend + let base = T.cons '@' suf + pure (maybe base (base <>) addend) + +pAddend :: Parser Text +pAddend = do + sign <- satisfy (\c -> c == '+' || c == '-') + digits <- takeWhile1P Nothing isDigit + pure (T.cons sign digits) + where + isDigit c = c >= '0' && c <= '9' pCondCode :: Parser Text pCondCode = lexeme $ takeWhile1P Nothing isAlphaNum