The contribute() function increments fund.amount_raised to track total contributions. Financial state variables should use checked arithmetic to prevent silent overflow.
Line 50 uses direct += addition without checked_add(). In Rust release builds without overflow-checks = true, integer overflow wraps silently. While the workspace Cargo.toml has overflow-checks enabled, defense-in-depth mandates explicit checked arithmetic for financial state.
Likelihood: Low
The workspace Cargo.toml has overflow-checks = true for the release profile, mitigating this in standard builds. The risk is conditional on Anchor build profiles not inheriting this setting.
Impact: High
Massive contributions could wrap amount_raised to near-zero, allowing the creator to claim the campaign failed while having received enormous funds.
Severity: Medium
The += operator uses wrapping arithmetic when overflow-checks is disabled. If the Anchor build profile does not inherit the workspace-level overflow-checks setting, a contribution of u64::MAX - current + 1 wraps amount_raised to near-zero.
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.