President Elector

First Flight #24
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Invalid

Array out-of-bounds access Revert When No Vote is Registered

Summary

If there is no valid vote, calling function selectPresident() will revert with array out-of-bounds access.

Vulnerability Details

The code on line 126 which is executed during the call to selectPresident() then _selectPresidentRecursive() assumes that there is always at least one entry on candidateList array.

address fewestVotesCandidate = candidateList[0];

If there is no vote, then candidateList is empty. Therefore, the code above tries to access an empty list which causes the revert.

Impact

The call to selectPresident() reverts.

Tools Used

Testing

Recommendations

Add a code to handle if there is no candidate to prevent the revert.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.