President Elector

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

No Limit On Candidate Choices Causes Denial Of Service On `selectPresident()`

Summary

Having too many candidates causes denial of service on the call to selectPresident()

Vulnerability Details

While the voters and number of maximum candidates per vote is predetermined, there is no predefined candidates in one election. Therefore, there can be a case where too many candidates are logged into the system.
This could lead to out-of-gas or even block gas limit exceeded problem when calling selectPresident(). This is because each candidate is tallied on the same function call, and also there is a recursive call until one candidate remains. This logic may take too much gas and may never complete.

Impact

The function selectPresident() cannot be called and therefore no president is selected.

Tools Used

Testing

Recommendations

Consider predefining a limited number of candidates.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

A high number of candidates could cause an OOG

Support

FAQs

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