Rules › Solidity
Compiler older than 0.8 (no overflow checks)
Before Solidity 0.8, arithmetic wraps silently unless every operation uses SafeMath.
Why it matters
Solidity 0.8 made arithmetic overflow and underflow revert by default. Code compiled with 0.7 or earlier wraps silently unless every operation goes through SafeMath, and older compilers also carry known code-generation bugs. Moving to a current 0.8.x release is usually straightforward and removes a whole class of bugs.
Vulnerable
pragma solidity 0.7.6;
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b; // wraps on overflow
}
Fixed
pragma solidity 0.8.28;
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b; // reverts on overflow
}
What other tools call it
| Tool | Detector or reference |
|---|---|
| Slither | solc-version |
| Solhint | compiler-version |
| SWC registry | SWC-101, SWC-102 |
Check your code
Paste a contract into the in-browser checker, or let the Claude Code plugin scan before every deploy. The quick check for this rule is a pattern match: treat a hit as "look here", and a miss as no guarantee.
Related rules
- tx.origin used for authorization
- State written after an external call (reentrancy)
- Return value of a low-level call is ignored
- delegatecall to an address the caller controls
- Initializer anyone can call
- Privileged function without access control
Static analysis finds known bug classes; it can't prove code is safe and isn't an audit. Get a professional audit before deploying code that will hold value.