The MathMasters.sol::mulWadUp()
function has an incorrectly implemented overflow risk check.
The MathMasters.sol::mulWadUp()
function implements an overflow check, which condition will never be evaluated to be true
. This means that if the input values to the function cause an overflow, the function will still produce a result, but it will be incorrect. As a consequence, calls to this function with such input values will not be reverted as expected, and the output will be unreliable.
The function call will not revert if the input overflows and will return an incorrect result.
Add the following test in MathMasters.t.sol
:
Run a test with forge test --mt test_MulWadUpShouldRevertOnOverflow
.
We should see an output similar to this in the terminal:
The test has failed because the function call did not revert as expected.
Manual review
Foundry
It is necessary to correct the implementation of the overflow condition check.
Recommended changes to MathMasters.sol::mulWadUp()
function:
If we attempt to execute the same test that was used in the PoC, we can see that it now passes as the function call reverted as expected:
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.