15,000 USDC
View results
Submission Details
Severity: medium
Valid

No check if `price>0` in `latestRoundData()`

Summary

chain;ink pricefeed can result price as zero in some conditions and here in the implementation there is no check if price is greater than zero or not causing inappropriate result

Vulnerability Details

see summary
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/libraries/OracleLib.sol#L21C4-L34C1

Impact

price can be zero and so getAccountCollateralValue and getUsdValue will result zero breaking dscEngine at many places

Tools Used

Manual

Recommendations

add a check if price from latestRoundZero is greater than zero , revert otherwise

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.