RustFund

First Flight #36
Beginner FriendlyRust
100 EXP
View results
Submission Details
Severity: medium
Invalid

Integer Overflow in RustFund::contribute can lead to loss of contributed funds

Summary

The Contribute function allow anyone interested in the campaign to contribute funds and the total fund is incremented with each contribution. Incase a large fund more than what can be contained by u64 is contributed, the maximum value that can be held by u64 ( 18,446,744,073,709,551,615) will be subtracted and only the remainder will be stored leading to loss of fund. This will distrupt the protocol but it is a meduim vunerality because the likelihood is low due to the large fund to be reached for this to occur

Vulnerability Details

The affected code

fund.amount_raised += amount;// integer oveflow can occur and should be replaced wit
fund.amount.checked_add(amount);

Impact

Loss of fund

Tools Used

Manual review

Recommendations

Updates

Appeal created

bube Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

[Invalid] Arithmetic overflow in `contribute` function

The max value of u64 is: 18,446,744,073,709,551,615 or around 18.4 billion SOL, given that the total supply of SOL on Solana is 512.50M, the scenario when the `contribute` function will revert due to overflow is very very unlikely to happen. Therefore, this is informational finding.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.