The function getUserDeposits
is intended for the user to see his id of each deposit. This function uses a loop to add each id to the array, but this function will not be available to the user if the number of his deposits exceeds 255
If the number of user deposits exceeds 255 (uint8.max ==255), the user will not be able to call
this function because it will be in an infinite loop.
Let's consider such a scenario:
User has 256 deposits and wants to know their id.
He calls this function.
The variable i is of type uint8, the loop will exist as long as i <256
the loop becomes infinite as the variable i is incremented in the unchecked block, thus reaching 255 , the variable i is updated to 0 and all over again.
Since this probability is very small, so the severity of the low
Paste the following code into PerpetualVault.t.sol
Call this test
Change the type of the variable i
from uint8
to at least uint16
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.