DeFiHardhat
12,000 USDC
View results
Submission Details
Severity: low
Invalid

Possible zero denominator inside the `roundUpDiv()` function

Summary

Function roundUpDiv() does not check for a possible zero denominator

Vulnerability Details

The internal roundUpDiv() function does not check if the denominator b is zero. The function will revert in the case of a possible zero denominator before rounding it up, thus breaking its intended logic. Calling functions likeroundUpDiv() from another contract should never revert.

Impact

Reverting in the case of a possible zero denominator, breaking the logic

Tools Used

Manual Review

Recommendations

Consider checking the denominator to not be zero:

function roundUpDiv(uint256 a, uint256 b) internal pure returns (uint256) {
+ require(b != 0, "ZERO DENOMINATOR");
if (a == 0) return 0;
return (a - 1) / b + 1;
}
Updates

Lead Judging Commences

giovannidisiena Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational/Invalid

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.