...
Failure to understand and properly use pointer arithmetic can allow an attacker to execute arbitrary code.
Rule | Severity | LikelihoodRemediation Cost | Detectable | Repairable | Priority | Level |
|---|---|---|---|---|---|---|
ARR39-C | High | Probable | No | HighNo | P6 | L2 |
Automated Detection
Tool | Version | Checker | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Astrée |
| scaled-pointer-arithmetic | Partially checked Besides direct rule violations, Astrée reports all (resulting) out-of-bound array accesses. | ||||||||||||||||||
| Axivion Bauhaus Suite |
| CertC-ARR39 | Fully implemented | ||||||||||||||||||
| CodeSonar |
| LANG.MEM.BO | Buffer overrun | ||||||||||||||||||
| Coverity |
| BAD_SIZEOF
| Partially implemented | ||||||||||||||||||
| Cppcheck Premium |
| premium-cert-arr39-c | |||||||||||||||||||
| Helix QAC |
| DF4955, DF4956, DF4957 | |||||||||||||||||||
| Klocwork |
| CERT.ARR.PTR.ARITH | |||||||||||||||||||
| LDRA tool suite |
| 47 S, 489 S, 567 S, 64 X, 66 X, 68 X, 69 X, 70 X, 71 X | Partially implemented | ||||||||||||||||||
| Parasoft C/C++test |
| BDCERT_C- | PB-ARRAY, MISRA-101, CODSTA-189Polyspace Bug Finder | R2016a | Incorrect pointer scaling, Pointer access out of bounds, Possible misuse of sizeof | Implicit scaling in pointer arithmetic might be ignored Pointer dereferenced outside its bounds Use of | PRQA QA-C | 9.1 | 2930, 2931, 2932, 2933, 2934 | PRQA QA-C++ | |||||||||||
| Include Page | cplusplus:PRQA QA-C++_V | cplusplus:PRQA QA-C++_V | 2840, 2841, 2842, 2843, 2844, 2930, 2931, 2932, 2933, 2934ARR39-a | Avoid accessing arrays out of bounds | |||||||||||||||||
| Polyspace Bug Finder |
| Checks for incorrect pointer scaling (rule fully covered). | |||||||||||||||||||
| RuleChecker |
| scaled-pointer-arithmetic | Partially checked | ||||||||||||||||||
| TrustInSoft Analyzer |
| index_in_address | Exhaustively detects undefined behavior (see one compliant and one non-compliant example). |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...