code-423n4 / 2024-04-dyad-findings

8 stars 6 forks source link

Upgraded Q -> 2 from #1018 [1714929888280] #1296

Closed c4-judge closed 5 months ago

c4-judge commented 5 months ago

Judge has assessed an item in Issue #1018 as 2 risk. The relevant finding follows:

[L-1] assetPrice() queries from Kerosene price to determine price will fail when TVL is 0 In the case TVL is 0, the function will revert as it attempts a subtraction from 0 operation which runs into an underflow. https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/Vault.kerosine.unbounded.sol#L65

function assetPrice() public view override returns (uint) { uint tvl; address[] memory vaults = kerosineManager.getVaults(); uint numberOfVaults = vaults.length; for (uint i = 0; i < numberOfVaults; i++) { Vault vault = Vault(vaults[i]); tvl += vault.asset().balanceOf(address(vault))

function assetPrice() public view override returns (uint) { uint tvl; address[] memory vaults = kerosineManager.getVaults(); uint numberOfVaults = vaults.length; for (uint i = 0; i < numberOfVaults; i++) { Vault vault = Vault(vaults[i]); tvl += vault.asset().balanceOf(address(vault))

c4-judge commented 5 months ago

koolexcrypto marked the issue as duplicate of #308

c4-judge commented 4 months ago

koolexcrypto marked the issue as satisfactory

c4-judge commented 4 months ago

koolexcrypto changed the severity to 3 (High Risk)