An audit of a standard arithmetic pattern — the overflow bug that drained early DeFi.
On Solidity < 0.8 (or inside unchecked blocks), arithmetic wraps on overflow:
uint8 balance = 255; balance += 1; → wraps to 0balance >= amount) after the wrapClassic victims: batch transfers, token-supply math, balance bookkeeping.
balances[a] -= x before verifying balances[a] >= x — an underflow to max value, granting a huge balance.
Medium — "unchecked arithmetic — potential overflow/underflow." On 0.8+ it correctly notes the compiler's checked arithmetic reverts by default — so it only flags the truly risky unchecked blocks.
Overflow was the #1 bug of the 2018-2020 era. AI catches it even in old-version or unchecked contexts — and correctly avoids false positives on 0.8+.