The function getRoundPhase() lacks fundamental input validation checks for market parameters and indices, potentially leading to unhandled exceptions and system vulnerabilities. It doesn't check if marketParameterIdx is valid and no verification if marketParams array is empty and this could cause unexpected reverts and lost gas.
https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/swan/BuyerAgent.sol#L334-#L362.
This vulnerability exist because there is no bounds checking for marketParameterIdx, missing array emptiness validation
and there is an absence of parameter sanity checks.
This vulnerability causes transaction failures after gas consumption, potential system halts from invalid indices and unexpected reverts causing user losses.
Manual code review
Add input validation
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.