icon

Solidity Overflow & Underflow

Last modified: 2023-09-27

Solidity is vulnerable to overflow and underflow of uint variables on the version <0.8.

Overflow

uint8 value = 255;
value++;
// Result: value = 0

Underflow

uint8 value = 0;
value--;
// Result: value = 255