Skip to content

Instantly share code, notes, and snippets.

@mixbytes-audit
mixbytes-audit / CheckIntOverflow.sol
Created September 23, 2021 13:34
Check int256 overflow
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
contract CheckIntOverflow {
//57896044618658097711785492504343953926634992332820282019728792003956564819967
int256 public constant INT256_MAX = type(int256).max;
//115792089237316195423570985008687907853269984665640564039457584007913129639935
uint256 public constant UNT256_MAX = type(uint256).max;

Checklist of known vulnerabilities

Well known bugs

Name description test cases
Integer overflow and underflow Integer types have maximum values. Overflow and underflow bugs can occur when you exceed the maximum value (overflow) or when you go below the minimum value (underflow) Example
Reentrancy Reentrancy is an attack that can occur when a bug in a contract function can allow a function interaction to proceed multiple times when it should otherwise be prohibited Example
Unprotected withdrawal Without adequate access controls, bad actors may be able to withdraw some or all assets from a contract Example
Unchecked low-level calls The return value of a low-level call is not checked [Example](https://github.com/crytic/sli