In the selectPresident()
function, after the recursive selection process, the contract expects only one candidate to remain in the winnerList
. However, if no candidates or multiple candidates remain in the winnerList
, the contract reverts with the error RankedChoice__SomethingWentWrong()
. This indicates incomplete handling of edge cases where no candidate is left.
If the voting process fails to eliminate enough candidates, it could lead to a situation where no president is selected, or the contract reverts due to multiple candidates remaining. This could halt the election process and leave the contract in an invalid state.
Proof of Concept:
The winnerList
may have multiple candidates after the selection process, leading to a reversion of the transaction. The contract assumes that the recursive selection will always leave only one candidate.
Manual Review
Implement a check to ensure that the winnerList
is not empty before finalizing the president selection and handle cases where multiple candidates remain.
'''
if (winnerList.length == 0) {
revert RankedChoice__SomethingWentWrong();
}
'''
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.