QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: medium
Invalid

On `OracleWrapper::getData` there should be a check for returned `data`

Summary

There is no check for returned data on OracleWrapper::getData

as this function is used in many different contracts:

Vulnerability Details

2024-12-quantamm/pkg/interfaces/contracts/pool-quantamm/OracleWrapper.sol at main · Cyfrin/2024-12-quantamm

/// @notice Get the data of the underlying oracle, interpretation of data depends on oracle type
/// @param data The underlying data (can be negative), normalized to 18 decimals
/// @return data Retrieved oracle data
/// @return timestamp Last update timestamp
function getData() public view returns (int216 data, uint40 timestamp) {
@> (data, timestamp) = _getData();
require(timestamp > 0, "INVORCLVAL"); // Sanity check in case oracle returns invalid values
}

Impact

the data can be Negative or zero that would likely indicate an error or an invalid price feed, and using such data could lead to incorrect calculations and unexpected behavior within the smart contract.

Tools Used

Manually reviewed

Recommendations

/// @notice Get the data of the underlying oracle, interpretation of data depends on oracle type
/// @param data The underlying data (can be negative), normalized to 18 decimals
/// @return data Retrieved oracle data
/// @return timestamp Last update timestamp
function getData() public view returns (int216 data, uint40 timestamp) {
(data, timestamp) = _getData();
+ require(data > 0, "error message");
require(timestamp > 0, "INVORCLVAL"); // Sanity check in case oracle returns invalid values
}
Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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