Location: contracts/libraries/Statistics.sol
Problem: If data.length is 0, the division operation (sum / data.length) will cause a revert due to division by zero. This issue affects all functions (avg, variance, and stddev) that use data.length in division operations without first checking if data.length > 0.
Recommendation: Add a check to ensure data.length > 0 before performing any calculations.
Tools used: Github and VSC
PoC:
Expected Outcome: The transaction will revert, demonstrating that the function fails to handle empty inputs gracefully.
Impact: Causes the transaction to revert, potentially affecting any contract relying on the Statistics library to process empty arrays. This can halt operations that are expected to handle edge cases gracefully.
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.