fix: external audit fixes for Pedersen#22434
Merged
ledwards2225 merged 2 commits intoApr 10, 2026
Merged
Conversation
…nteger underflow in convert_buffer on empty input
65f5f76 to
fc40256
Compare
ledwards2225
approved these changes
Apr 10, 2026
3178ffc
into
merge-train/barretenberg
21 of 22 checks passed
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Apr 13, 2026
BEGIN_COMMIT_OVERRIDE fix: skip heavy recursion tests in debug builds (#22446) fix: add clear error for unsatisfiable ACIR AssertZero opcode (#22417) feat: enforce accumulator_not_empty = 0 at ECCVM lagrange_first row (#22461) fix: skip heavy recursion tests in debug builds, keep one for assertion coverage (#22389) fix: external audit fixes for Pedersen (#22434) chore!: fix BASE off-by-one in create_small_range_constraint in theta step of keccak (#22404) fix: external audit fixes for Keccak (#22436) fix: external audit fixes for BLAKE (#22443) chore: misc hash gadget updates (#22452) END_COMMIT_OVERRIDE
critesjosh
pushed a commit
that referenced
this pull request
Apr 14, 2026
**finding 19: guard in `hash` for empty inputs** --- fixed 29e5bbb The guarantee documented in `pedersen.hpp` “hash output is never point at infinity” applies when the input size is greater than 0. When called on an empty input, `hash` was returning the x co-ordinate of point at infinity. This is addressed now by adding a `throw_or_abort` guard in `hash`to catch empty inputs. Tests are also included which verify that hashing an empty input throws an exception. **finding 2: guard to prevent integer underflow in `convert_buffer` on empty input** --- fixed fc40256 `convert_buffer` had an integer underflow when it was passed an empty input. This is addressed by including a `throw_or_abort` guard in `hash_buffer` before the call to `convert_buffer` is made so that an empty input cannot be sent to `convert_buffer`. Tests are also included which verify that hashing an empty input throws an exception. **finding 18: capping `hash_index` `bbapi` Pedersen handlers** --- not fixed `hash_index` is currently not capped. However, as pointed out, it is hardcoded to 0 in the current code and is not reachable. Hence, not fixing this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
finding 19: guard in
hashfor empty inputs --- fixed 29e5bbbThe guarantee documented in
pedersen.hpp“hash output is never point at infinity” applies when the input size is greater than 0. When called on an empty input,hashwas returning the x co-ordinate of point at infinity. This is addressed now by adding athrow_or_abortguard inhashto catch empty inputs. Tests are also included which verify that hashing an empty input throws an exception.finding 2: guard to prevent integer underflow in
convert_bufferon empty input --- fixed fc40256convert_bufferhad an integer underflow when it was passed an empty input. This is addressed by including athrow_or_abortguard inhash_bufferbefore the call toconvert_bufferis made so that an empty input cannot be sent toconvert_buffer. Tests are also included which verify that hashing an empty input throws an exception.finding 18: capping
hash_indexbbapiPedersen handlers --- not fixedhash_indexis currently not capped. However, as pointed out, it is hardcoded to 0 in the current code and is not reachable. Hence, not fixing this.