Skip to main content

How Does the Signed Integer Type Change the Definition of Overflow/underflow?

The signed integer type (e.g. int256 ) changes the definition by allowing for both positive and negative values, with half the range dedicated to each. Overflow occurs when a positive number exceeds the maximum positive value, wrapping to the maximum negative value.

Underflow occurs when a negative number goes below the maximum negative value, wrapping to the maximum positive value. In contrast, unsigned integers ( uint256 ) only handle non-negative values, where underflow wraps from zero to the maximum positive value.

What Tools Are Used to Detect Integer Overflow and Underflow Vulnerabilities?
What Specific Types of Vulnerabilities Are Common in Turing-Complete Smart Contracts but Absent in Non-Turing-Complete Ones?
Can an ‘Unsigned’ Smart Contract Be Legally Binding?
What Is the Role of the Solidity Compiler in Mitigating Integer Vulnerabilities?