The binarySearch exit condition is missing and may go into DOS or revert #445
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-a
Q-02
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/GenerationSoftware/pt-v5-prize-pool/blob/4bc8a12b857856828c018510b5500d722b79ca3a/src/libraries/DrawAccumulatorLib.sol#L454-L456
Vulnerability details
Impact
The binarySearch does not check for overlap between the left and right index of the sliding window, and loops indefinitely when satisfies item not exists in list until revert or gas is exhausted.
Proof of Concept
According to the code only
targetAtOrAfter &&_targetLastClosedDrawId <= afterOrAtDrawId
can break loop, if no element in the list meets the condition, it loops indefinitely until the array index overflows or exhausts gasTools Used
Manual review
Recommended Mitigation Steps
Should check
leftSide > rightSide
to break the loopAssessed type
Loop
The text was updated successfully, but these errors were encountered: