code-423n4 / 2023-10-wildcat-findings

14 stars 10 forks source link

wrong implementation of rayDiv. #684

Closed c4-submissions closed 1 year ago

c4-submissions commented 1 year ago

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) }

  c := div(add(mul(a, RAY), div(b, 2)), b)
}

}

i think its wrong implementation.

Assessed type

Other

c4-pre-sort commented 1 year ago

minhquanym marked the issue as low quality report

minhquanym commented 1 year ago

Invalid

c4-judge commented 1 year ago

MarioPoneder marked the issue as unsatisfactory: Invalid