...
Passing an invalid type or member to offsetof() can result in undefined behavior that might be exploited to cause data integrity violations or result in incorrect values from the macro expansion.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
EXP59-CPP | Medium | Unlikely | Medium | P4 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Axivion Bauhaus Suite |
| CertC++-EXP59 | |||||||
| Clang |
|
| Emits an error diagnostic on invalid member designators, and emits a warning diagnostic on invalid types. | ||||||
| GCC |
|
| Emits an error diagnostic on invalid member designators, and emits a warning diagnostic on invalid types. |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Bibliography
| [ISO/IEC 9899:1999] | Subclause 7.17, "Common Definitions <stddef.h>" |
| [ISO/IEC 14882-2014] | Subclause 9.4.2, "Static Data Members" Subclause 18.2, "Types" |
...
...