contribute (programs/rustfund/src/lib.rs) increments the fund counter with a plain +=, while every other arithmetic operation in the program uses checked_add / checked_sub and maps failure to ErrorCode::CalculationOverflow:
In release builds (anchor build compiles with --release) Rust integer overflow wraps silently unless overflow-checks = true is set in the release profile. The workspace Cargo.toml [profile.release] does not enable it, so the += above is a wrapping add on-chain.
Impact: Low — on wrap, amount_raised would become a small number: the goal check (once added) would report an unsuccessful campaign, and withdraw would move only the wrapped remainder, leaving the real contributions stranded in the PDA. The program defines CalculationOverflow precisely to prevent this and applies it in every other arithmetic path, so this is an inconsistency in the overflow policy rather than an exploitable path today.
Likelihood: Low — reaching u64::MAX lamports (~1.8e19, ≈ 18.4 billion SOL) exceeds total SOL supply; not reachable with real balances.
Not reproducible with realistic balances on a validator. The wrapping behaviour itself in release mode:
Use the same checked arithmetic as the rest of the program:
Optionally also enable overflow checks for the on-chain build so any future unchecked operation fails loudly:
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.