The _splitWeightAndMultipliers function in QuantAMMWeightedPool.sol line 722 is designed to split an array of weights and multipliers into two separate arrays. However, it assumes that the input length is always even, dividing it into equal halves of weights and multipliers. If the input array has an odd length, the calculation of tokenLength = weights.length / 2 truncates the fractional part, resulting in potential indexing issues and incorrect handling of data.
The function assumes weights.length is always even and divides it by 2 (tokenLength = weights.length / 2) without validating this assumption.
If weights.length is odd, tokenLength becomes an incorrect value, as Solidity truncates division results to the nearest integer (e.g., 5 / 2 = 2).
The first loop correctly processes the first half of the weights but may fail to account for all tokens due to incorrect tokenLength.
The function produces incomplete or malformed splitWeights arrays
Manual Audits
Require tokens length be divisible by 2 before spliiting
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.