...
Making invalid assumptions about the type of a bit-field or its layout can result in unexpected program flow.
Recommendation | Severity | Likelihood |
|---|
Detectable | Repairable | Priority | Level |
|---|---|---|---|
INT12-C | Low | Unlikely |
No | No |
P1 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Astrée |
| bitfield-type | Fully checked | ||||||
| Axivion Bauhaus Suite |
| CertC-INT12 | |||||||
| CodeSonar |
| LANG.TYPE.BFSIGN | Bit-field signedness not explicit | ||||||
| Compass/ROSE |
| CC2.INT12 | Fully implemented | |||||||
| Helix QAC |
| C0634, C0635 | |||||||
| Klocwork |
| MISRA.BITFIELD.TYPE | |||||||
| LDRA tool suite |
| 73 S | Fully implemented | ||||||
| Parasoft C/C++test |
0634 (I)
0635
| CERT_C-INT12-a | Bit fields shall only be defined to be of type unsigned int or signed int | |||||||
| PC-lint Plus |
| 846 | Fully supported | ||||||
| Polyspace Bug Finder |
| Checks for bit-field declared without appropriate type (rec. fully covered) | |||||||
| RuleChecker |
| bitfield-type | Fully checked | ||||||
| SonarQube C/C++ Plugin |
| S814 |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
| SEI CERT C++ Coding Standard | VOID INT12-CPP. Do not make assumptions about the type of a plain int bit-field when used in an expression |
| ISO/IEC TR 24772:2013 | Bit Representations [STR] |
| MISRA C:2012 | Rule 10.1 (required) |
Bibliography
| [ISO/IEC 9899:2011] | Subclause 6.3.1.1, "Boolean, Characters, and Integers" |
...
...