Closed c4-submissions closed 1 year ago
https://github.com/code-423n4/2023-10-wildcat/blob/main/src/libraries/MathUtils.sol#L155
Detailed description of the impact of this finding.
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
function rayDiv(uint256 a, uint256 b) internal pure returns (uint256 c) { assembly { // equivalent to require(b != 0 && a <= (type(uint256).max - halfB) / RAY) if or(iszero(b), gt(a, div(sub(not(0), div(b, 2)), RAY))) { mstore(0, Panic_ErrorSelector) mstore(Panic_ErrorCodePointer, Panic_Arithmetic) revert(Error_SelectorPointer, Panic_ErrorLength) }
require(b != 0 && a <= (type(uint256).max - halfB) / RAY)
c := div(add(mul(a, RAY), div(b, 2)), b) }
}
i think its wrong implementation.
Other
minhquanym marked the issue as low quality report
Invalid
MarioPoneder marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-10-wildcat/blob/main/src/libraries/MathUtils.sol#L155
Vulnerability details
Impact
Detailed description of the impact of this finding.
Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
Tools Used
Recommended Mitigation Steps
function rayDiv(uint256 a, uint256 b) internal pure returns (uint256 c) { assembly { // equivalent to
require(b != 0 && a <= (type(uint256).max - halfB) / RAY)
if or(iszero(b), gt(a, div(sub(not(0), div(b, 2)), RAY))) { mstore(0, Panic_ErrorSelector) mstore(Panic_ErrorCodePointer, Panic_Arithmetic) revert(Error_SelectorPointer, Panic_ErrorLength) }}
i think its wrong implementation.
Assessed type
Other