...
Failure to cast integers before comparing or assigning them to a larger integer size can result in software vulnerabilities that can allow the execution of arbitrary code by an attacker with the permissions of the vulnerable process.
Rule | Severity | Likelihood | Detectable | RepairableRemediation Cost | Priority | Level |
|---|---|---|---|---|---|---|
INT18-C | High | Likelyhigh | likelyNo | mediumYes | P18 | L1 |
Automated Detection
Tool | Version | Checker | Description | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Astrée |
| Supported, but no explicit checker | |||||||||||||||
| CodeSonar |
| LANG.TYPE.AWID | Expression value widened by assignment | ||||||||||||||
| Compass/ROSE | Can detect violations of this rule. It should look for patterns of
| ||||||||||||||||
| Coverity | 6.5 | OVERFLOW_BEFORE_WIDEN | Fully implemented | ||||||||||||||
| Helix QAC |
| C1890, C1891, C1892, C1893, C1894, C1895, C4490, C4491, C4492 | |||||||||||||||
| Klocwork |
| PORTING.CAST.SIZE | |||||||||||||||
| LDRA tool suite |
| 452 S | Partially implemented | ||||||||||||||
| Parasoft C/C++test |
| CERT_C-INT18-a | Avoid possible integer overflow in expressions in which the result is assigned to a variable of a wider integer type | ||||||||||||||
| Polyspace Bug Finder | R2016a | Overflow when converting between integer types Overflow from operation between integers Overflow when converting between unsigned integer types Overflow from operation between unsigned integers | PRQA QA-C | ||||||||||||||
| Include Page | PRQA QA-C_v | PRQA QA-C_v | 1890, 1891, 1892, |
| Checks for integer overflow and unsigned integer overflow (rec. fully covered) Partially implemented |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...