In the _distribute function, the loop that iterates over the percentages array to calculate the totalPercentage lacks a condition to prevent integer overflow. If the percentages array is very large, this could lead to an unintended overflow, resulting in an incorrect value for totalPercentage. As a consequence, this could disrupt the prize distribution logic and impact the accuracy of the distribution percentages.
If the percentages array is very large, this could lead to an unintended overflow, resulting in an incorrect value for totalPercentage. As a consequence, this could disrupt the prize distribution logic and impact the accuracy of the distribution percentages.
Without proper checks, an unchecked loop like this may cause an integer overflow, leading to an inaccurate totalPercentage value. This can result in incorrect distribution calculations and potentially unauthorized token transfers.
Manual
To prevent integer overflow, add a condition to validate the length of the percentages array and ensure that it doesn't cause an unintended overflow during iteration. This will help maintain accurate calculations and proper distribution of prizes.
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.