Closed github-actions[bot] closed 1 year ago
eierina
false
BBMath's divCeil can overflow.
divCeil sums the quotient and the dividend, which may overflow.
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) { return (a + b - 1) / b; }
Overflow if the sum of the quotient and the dividend is greater than type(uint256).max.
https://github.com/sherlock-audit/2023-02-blueberry/blob/main/contracts/libraries/BBMath.sol#L7-L9
Manual Review
Change divCeil with a form that does not overflow.
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) { return a == 0 ? 0 : (a - 1) / b + 1; }
eierina
false
BBMath can overflow
Summary
BBMath's divCeil can overflow.
Vulnerability Detail
divCeil sums the quotient and the dividend, which may overflow.
Impact
Overflow if the sum of the quotient and the dividend is greater than type(uint256).max.
Code Snippet
https://github.com/sherlock-audit/2023-02-blueberry/blob/main/contracts/libraries/BBMath.sol#L7-L9
Tool used
Manual Review
Recommendation
Change divCeil with a form that does not overflow.