The getAccountsWithActivePositions
function retrieves account IDs with active positions between a specified lower and upper bound. There is an issue where if upperBound
is less than lowerBound
, it can cause an underflow, leading to potential errors.
Proof of Impact and Vulnerability: If upperBound
is less than lowerBound
:
Underflow: The subtraction upperBound - lowerBound
can cause an underflow, resulting in an excessively large array or exception.
Loop Malfunction: The for loop for (uint256 i = lowerBound; i <= upperBound; i++)
will not work correctly, leading to errors.
Example Scenario: If lowerBound
is 10 and upperBound
is 5, upperBound - lowerBound + 1
causes an underflow, potentially leading to contract reversion or an unexpected array size.
Manual review
To fix this issue, add a validation check to ensure upperBound
is greater than or equal to lowerBound
:
}
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.