Casting from a larger integer type to a smaller integer type without checking for overflow can result in data loss LibWellMinting::twaDeltaB()
function when we try to cast uint256 timestamp to uint40 this not safe without safeCast library
s.season.timestamp
is of type uint256, which has a larger range than uint40. If the value of s.season.timestamp
is larger than the maximum value that can be represented by uint40
, then casting it to uint40 will result in truncation of the value and overflow.
Manual Review
To avoid this issue, it is recommended to use a safe casting library, such as SafeCast, to perform the cast safely. SafeCast provides functions for performing safe casts between different integer types, including checking for overflows and underflows.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.