Skip to content

Input sanitization - #3

Merged
zemse merged 2 commits into
mainfrom
input-sanitization
Feb 14, 2026
Merged

zemse merged 2 commits into
mainfrom
input-sanitization

Conversation

@zemse

@zemse zemse commented Feb 14, 2026 •

Copy link
Copy Markdown
Owner

When inputs are larger than PRIME value (which is anyway an invalid case), it causes this implementation to overflow in some cases.

This PR ensures inputs are sanitised at entry point in both yul and huff contracts at a negligible cost (+24 gas for huff and +32 gas for yul).

E.g. The case hash_2 with type(uint256).max fails the test. After the fix, the test passes.

@zemse
zemse force-pushed the input-sanitization branch from d8de025 to d57c6ec Compare February 14, 2026 08:55
@zemse
zemse force-pushed the input-sanitization branch from d57c6ec to c66752f Compare February 14, 2026 09:00
@zemse
zemse merged commit d3cca68 into main Feb 14, 2026
1 check passed
zemse added a commit that referenced this pull request Jun 20, 2026
* add failing test case

* ensure inputs are sanitized
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.

1 participant