Overflow is not caught in inline assembly and multiplication yields gibberish value.
In line 52, an x * y overflow check is done with:
However, it is not equivalent to the require in the comment and we can check with Forge:
The function above runs normally without a revert and yields 0 as a result.
This is a critical bug because a protocol using this library might be counting on the fact that overflows are caught correctly, thus causing logic issues whenever this function is used.
Forge.
I recommend replacing line 52 with:
if mul(y, gt(x, div(not(0), y))) { // notice the absence of the or() instruction.
The overflow check is correctly implemented in mulWad, at line 39:
if mul(y, gt(x, div(not(0), y))) {
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.