Skip to content

fix(zarith): raise ArgumentError on malformed input#19

Merged
vhf merged 1 commit into
mainfrom
fix/zarith
May 19, 2026
Merged

fix(zarith): raise ArgumentError on malformed input#19
vhf merged 1 commit into
mainfrom
fix/zarith

Conversation

@vhf
Copy link
Copy Markdown
Contributor

@vhf vhf commented May 19, 2026

  • decode("80") returned 0 (continuation bit set, no following byte)
  • decode("ff") returned -63 (instead of raising)
  • consume("") raised MatchError from hex_to_dec("")
  • consume("a1d22") (odd hex length) raised FunctionClauseError

Now consume/1 validates upfront (non-empty, even-length hex) and find_int + read_next raise on truncation (continuation bit set with no following byte). read/1 now branches on the halt bit explicitly so single-byte zarith inputs still terminate cleanly.

Now consume/1 validates upfront (non-empty, even-length hex) and
find_int + read_next raise on truncation (continuation bit set with
no following byte). read/1 now branches on the halt bit explicitly
so single-byte zarith inputs still terminate cleanly.
@vhf vhf requested a review from Awea May 19, 2026 07:16
@vhf vhf merged commit 08ce3d1 into main May 19, 2026
1 check passed
@vhf vhf deleted the fix/zarith branch May 19, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants