Unsafe int256
casts in accrueDebt
#128
Labels
1 (Low Risk)
Assets are not at risk. State handling, function incorrect as to spec, issues with comments
bug
Something isn't working
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
cmichel
Vulnerability details
As
MochiVault.accrueDebt
function performs unsafe casts:claimable += int256(increased);
.If the unsigned values are above the maximum signed value (
type(int256).max
), it will be interpreted as a negative value instead.Impact
Even though overflowing the max
int256
value is unlikely, it's still recommended to use safe casts.Recommended Mitigation Steps
Make sure the value fits into the type first by using a SafeCast library.
The text was updated successfully, but these errors were encountered: