hats-finance / Tokemak-0x4a2d708ea6b0c04186ecb774cfad1e50fb5efc0b

0 stars 0 forks source link

Consider using OpenZeppelin's SafeCast library to prevent unexpected overflows when downcasting #15

Open hats-bug-reporter[bot] opened 5 months ago

hats-bug-reporter[bot] commented 5 months ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0xdfcb7680f60a31235951712f2ff8cee290c974857b412632b341454222695d19 Severity: low

Description: Description\ Downcasting from uint256/int256 in Solidity does not revert on overflow. This can result in undesired exploitation or bugs, since developers usually assume that overflows raise errors. OpenZeppelin's SafeCast library restores this intuition by reverting the transaction when such an operation overflows. Using this library eliminates an entire class of bugs, so it's recommended to use it always. Some exceptions are acceptable like with the classic uint256(uint160(address(variable)))

Instances (1):

File: WithdrawalQueue.sol

21:         return address(uint160(x));
codenutt commented 5 months ago

Contract is out of scope