The mulWad
and mulWadUp
functions both check for overflow in case of multiplication of two numbers before the multiplication is done. However, the condition check in mulWadUp
is wrong and may revert even if the multiplication does not overflow.
The condition to check for overflow in mulWadUp
is wrong and may revert even if the multiplication does not overflow, which is not expected behaviour. The current condition does not match the require(y == 0 || x <= type(uint256).max / y)
. It contains additional or
and gt
operations which are not needed and also modify the condition in a way that it would revert even if the multiplication does not overflow.
The impact is high, as it would revert even if the multiplication does not overflow. One example of the issue this may produce is it may affect the protocols using this function as the execution would revert even though it shouldn't, therefore stopping the execution of the protocol.
Foundry fuzz tests
The condition to check for overflow should be fixed to match the one in mulWad
function which is correct.
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.