<!-- canonical: https://0xsimao.com/findings/ostium-casting-int256-won-revert -->

# Casting from int256 to uint256 won't revert if the number is negative, possibly leading to issues

Crit/High · Three Sigma · RWA perpetuals DEX · 19th February, 2024

Finding 3S-OS-M11 of the Ostium security review.

- Protocol: https://www.ostium.com/
- Report: /reports/ostium
- Source: https://cdn.sanity.io/files/qoqld077/production/a95b9c69e0f65d1d6b0e649f0d62a362358ca8ce.pdf

---

### Description

Some instances, namely in [OstiumPairInfos::getPendingAccFundingFees()](https://github.com/0xOstium/smart-contracts-threeSigma/blob/audit-feedback/src/OstiumPairInfos.sol#L447-L473), cast int256 to
uint256.

### Recommendation

Avoid casting directly and use a wrapper library instead such as SafeCastUpgradeable.

### Status

Addressed in [#38b09ab](https://github.com/0xOstium/smart-contracts-threeSigma/pull/58/commits/38b09ab4a2b75ea2c4f5061f0c833444058ccfcf).

---

Related findings:

- [Solidity types uint256 are never negative](https://0xsimao.com/findings/mitosis-solidity-types-uint256-negative): Mitosis
