Skip to content

Fix capacity overflow panic and validate punchcard account layout#1

Open
benedictbrady wants to merge 1 commit intoEllipsis-Labs:masterfrom
benedictbrady:codex/fix-capacity-overflow-claims
Open

Fix capacity overflow panic and validate punchcard account layout#1
benedictbrady wants to merge 1 commit intoEllipsis-Labs:masterfrom
benedictbrady:codex/fix-capacity-overflow-claims

Conversation

@benedictbrady
Copy link

@benedictbrady benedictbrady commented Feb 19, 2026

Summary

  • prevent overflow in punchcard account sizing by using checked arithmetic for capacity
  • reject invalid capacities during Create with a dedicated custom error (InvalidCapacity)
  • harden Claim parsing by validating account data length/shape before accessing bitset storage
  • reject malformed state where claimed > capacity
  • add unit tests covering overflowed capacities and malformed account data

Security impact

This fixes a panic path where large capacities (for example u64::MAX) under-allocate account data in release builds, then panic on Claim due to out-of-bounds bitset access.

Testing

  • cargo test --lib
  • cargo test --release --lib

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