...
Accessing a pointer or an object that is not properly aligned can cause a program to crash or give erroneous information, or it can cause slow pointer accesses (if the architecture allows misaligned accesses).
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
EXP36-C | Low | Probable | Medium | P4 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||
---|---|---|---|---|---|---|---|
Astrée |
|
Supported, but no explicit checker | |
Compass/ROSE |
Can detect violations of this rule. However, it does not flag explicit casts to | |||||||||
Coverity |
| MISRA C 2004 Rule 11.4 MISRA C 2012 Rule 11.1 MISRA C 2012 Rule 11.2 MISRA C 2012 Rule 11.5 MISRA C 2012 Rule 11.7 | Implemented | ||||||
| CC2.EXP36 | Fully implemented | |||||||
EDG |
GCC |
|
Can detect some violations of this rule when the | ||||||||
Klocwork |
| MISRA.CAST.PTR.UNRELATED |
LDRA tool suite |
| 94 S, 606 S | Partially implemented | ||||||
Parasoft C/C++test |
|
|
| MISRA2004-11_4 | Fully implemented | |||||||
Polyspace Bug Finder | R2016a | Unreliable cast of pointer | Pointer implicitly cast to different data type | ||||||
PRQA QA-C |
| 3305 | Fully implemented | ||||||
PRQA QA-C++ |
| 3033, 3038 |
PVS-Studio | 6.22 | V548, V641 | General analysis rule set |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...
Key here (explains table format and definitions)
Taxonomy | Taxonomy item | Relationship |
---|---|---|
CERT C | VOID EXP56-CPP. Do not cast pointers into more strictly aligned pointer types | Prior to 2018-01-12: CERT: Unspecified Relationship |
ISO/IEC TR 24772:2013 | Pointer Casting and Pointer Type Changes [HFC] | Prior to 2018-01-12: CERT: Unspecified Relationship |
ISO/IEC TS 17961 | Converting pointer values to more strictly aligned pointer types [alignconv] | Prior to 2018-01-12: CERT: Unspecified Relationship |
MISRA C:2012 | Rule 11.1 (required) | Prior to 2018-01-12: CERT: Unspecified Relationship |
MISRA C:2012 | Rule 11.2 (required) | Prior to 2018-01-12: CERT: Unspecified Relationship |
MISRA C:2012 | Rule 11.5 (advisory) | Prior to 2018-01-12: CERT: Unspecified Relationship |
MISRA C:2012 | Rule 11.7 (required) | Prior to 2018-01-12: CERT: Unspecified Relationship |
Bibliography
[Bryant 2003] |
[ISO/IEC 9899:2011] | 6.3.2.3, "Pointers" |
[Walfridsson 2003] | Aliasing, Pointer Casts and GCC 3.3 |
...
...