Unprotected overflow issue in getUserDeposits function
The getUserDeposits
function in the PerpetualVault
contract has a potential issue with integer overflow.
Below is a function from the PerpetualVault
contract:
Because the loop variable i
uses uint8
, which can only store values up to 255, if a user has more than 255 deposits, the loop variable overflows, causing problems like infinite loops or incorrect data.
If a user has more than 255 deposits, the function will fail, which could disrupt the application.
Manual Review
Change the loop variable type from uint8
to uint256
.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.