Skip to content

fix: external audit fixes for Pedersen#22434

Merged
ledwards2225 merged 2 commits into
merge-train/barretenbergfrom
nk/pedersen-ext-audit-fix
Apr 10, 2026
Merged

fix: external audit fixes for Pedersen#22434
ledwards2225 merged 2 commits into
merge-train/barretenbergfrom
nk/pedersen-ext-audit-fix

Conversation

@nishatkoti

@nishatkoti nishatkoti commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

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 hashto 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.

@nishatkoti nishatkoti force-pushed the nk/pedersen-ext-audit-fix branch from 65f5f76 to fc40256 Compare April 9, 2026 10:49
@nishatkoti nishatkoti changed the title External audit fixes for Pedersen fix: external audit fixes for Pedersen Apr 9, 2026
@nishatkoti nishatkoti marked this pull request as ready for review April 9, 2026 14:37
@ledwards2225 ledwards2225 merged commit 3178ffc into merge-train/barretenberg Apr 10, 2026
21 of 22 checks passed
@ledwards2225 ledwards2225 deleted the nk/pedersen-ext-audit-fix branch April 10, 2026 19:50
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.
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