# UniswapV2PriceOracle.sol currentCumulativePrices() will revert when priceCumulative addition overflow

Phuture's UniswapV2PriceOracle calls Uniswap's oracle library compiled under Solidity 0.8, so the intended cumulative-price overflow reverts, bricking the oracle and dependent system.

- Payout: Audit contest
- Severity: high
- Program: Phuture Finance
- Credited: WatchPug
- Disclosed: 2022-02-11
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2022-04-phuture-findings/issues/62
- Library page: https://bugbountylibrary.com/r/c4%3A2022-04-phuture%3AH-02
- Tags: domain:web3 impact:dos kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:regression technique:source-review vuln:dos vuln:oracle-manipulation

**Target:** UniswapV2PriceOracle.sol / UniswapV2OracleLibrary.sol
**Root cause:** UniswapV2OracleLibrary relies on intentional uint overflow in price0Cumulative/price1Cumulative addition, but is compiled with Solidity >=0.8.7 where arithmetic overflow reverts.
**Steps:**
1. Note UniswapV2PriceOracle.sol#L62 calls pair.currentCumulativePrices() from UniswapV2OracleLibrary
2. Observe library compiled with Solidity >=0.8.7, where overflow/underflow revert
3. Library code does price0Cumulative += fraction(reserve1,reserve0)._x * timeElapsed expecting wraparound
4. Once cumulative price grows large enough, the addition overflows and the call reverts
5. Oracle breaks, cascading to all system components depending on it
**How found:** Code review comparing the Solidity pragma of the vendored UniswapV2OracleLibrary against its reliance on intentional overflow semantics from pre-0.8 Solidity.
**Insight:** When a protocol vendors Uniswap's pre-0.8 libraries (oracle, TWAP, FixedPointMath) under a 0.8+ pragma, check every arithmetic op the original comments mark as 'overflow is desired' — they now revert and can brick the oracle.
