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

Unsafe cast to uint64

Summary

Potential for Integer Overflow in uint64 Casting

Vulnerability Details

The current implementation of casting the fee variable to uint64 during its addition to totalFees poses a risk of integer overflow. If the calculated fee exceeds the maximum value that a uint64 can hold, it will result in an overflow, leading to incorrect tallying of totalFees

Impact

In the event of an overflow, totalFees would not accurately reflect the accumulated fees. This discrepancy could lead to funds becoming trapped within the smart contract, as the true amount of fees might surpass the recorded totalFees. Consequently, this would prevent the complete withdrawal of funds that are legitimately owed.

Tools Used

Manual review

Recommendations

Use SafeCast.toUint64(fee) from OZ

Updates

Lead Judging Commences

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

unsafe cast of fee to uint64

Support

FAQs

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

Give us feedback!