President Elector

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

Lack of Input Size Limitation for `rankCandidatesBySig`

Description: The rankCandidatesBySig function allows users to submit an array of candidate addresses without any explicit limitation on the size of this input. This could potentially lead to excessively large inputs, which can result in high gas consumption and even denial of service if the transaction runs out of gas.

Impact:

  • Excessive Gas Costs: Large inputs can lead to high gas costs, making transactions expensive for users.

  • Denial of Service (DoS): If the input size is too large, it could cause the transaction to run out of gas, preventing the function from executing successfully and potentially disrupting the voting process.

Proof of Concept: The function currently does not impose a size limit on orderedCandidates:

function rankCandidatesBySig(
address[] memory orderedCandidates,
bytes memory signature
) external {
// No size check on orderedCandidates
...
}

Recommended Mitigation:

  • Implement Input Size Checks: Enforce a maximum size for the orderedCandidates array to prevent excessively large inputs.

  • Validate Input Length: Ensure that the length of the input array is within reasonable bounds before processing it.

  • Optimize Gas Usage: Consider optimizing the function to handle inputs more efficiently, reducing the risk of running out of gas.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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