In calcLPTokenUnderlying(), lpTokenSupply is used in the calculation of underlyingAmounts[0] and underlyingAmounts[1]. However, there is no check if the lpTokenSupply is zero which is used as division in the calculation.
calcLPTokenUnderlying()
https://github.com/Cyfrin/2024-04-Beanstalk-DIB/blob/d70f9bfe54f4ec5a3278a6ac7e24336612289903/src/functions/ProportionalLPToken2.sol#L15C14-L24
If the lpTokenSupply is zero, the calculation would result in a division by zero error. This is because of the denominator in the calculation. When the lpTokenSupply is zero, dividing by zero is not defined in Solidity, and the contract would revert with an error.
Manual Review
Appropriate checks should be added to ensure that the lpTokenSupply is non-zero before performing the division operation.
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.