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 Are the Security Risks Associated with Rebase Token Smart Contracts?
What Is an Integer Overflow and How Does It Impact Token Balances?
What Is the Safe Math Library and Why Is It Used?
How Can an Underflow Be Exploited to Drain Funds from a Contract?
Can SafeMath Prevent All Logic Errors Related to Arithmetic?
Explain the Difference between an Overflow and an Underflow
What Tools Are Used to Detect Integer Overflow and Underflow Vulnerabilities?
Why Is SafeMath Less Necessary in Solidity 0.8.0 and Later?