Unhandled exceptions in the distributeRewards()
function
In the loop where the contract iterates over the distributionAmounts
array. The code assumes that the length of _rewardTokens
and _rewardTokenAmounts
arrays are equal, but there's no explicit check for this. If these arrays have different lengths, the loop may try to access an element beyond the end of one of the arrays, resulting in an ArrayIndexOutOfBoundsException
.
Add a check to ensure that the loops do not exceed the bounds of the arrays.
This modification ensures that the contract checks the lengths of the input arrays before entering the loop, preventing any potential ArrayIndexOutOfBoundsException
. It also adds a require
statement inside the loop to check that the current index does not exceed the length of _rewardTokenAmounts
, providing an additional layer of protection against this specific type of exception.
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.