It assumes the length of the reserves array is 2, so j
argument should be less than 2 but there is no checking for it.
If the j
argument isn't less than 2 and the reserves
array has a different size than expected (not 2), it could lead to unexpected behavior or errors in these functions.
https://github.com/Cyfrin/2024-04-Beanstalk-DIB/blob/main/src/functions/ConstantProduct2.sol#L92
https://github.com/Cyfrin/2024-04-Beanstalk-DIB/blob/main/src/functions/ConstantProduct2.sol#L105
https://github.com/Cyfrin/2024-04-Beanstalk-DIB/blob/main/src/functions/ConstantProduct2.sol#L114
It could cause unexpected behavior or errors.
Manual
Consider adding checks to ensure both the reserves
array length and the j
parameter meet the expected criteria.
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.