Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Valid

'totalFees' Potential Overflow

Summary

Inside the 'selectwinner' function there is a bug in the fee calculation.
We are using uint64 but we should be using uint256.

Vulnerability Details

Using uint64 in the 'totalFees = totalFees + uint64(fee)' calculation could result in a overflow bug when the fees are greater than 18.4 ETH.

Impact

The fee calculation will overflow when the collected fee is greater then 18.4 ETH.
Which will result in the fees being calculated in a wrong way causing the fees to be less then they should be.

Tools Used

Vs Code
Foundry

Recommendations

Always use uint256 for these kind of values.
In this case it will need a fee greater than 18.4 ETH to overflow but if the raffle gains good traction this is certainly possible so it should be avoided.

Updates

Lead Judging Commences

Hamiltonite Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

overflow-uint64

Support

FAQs

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