...
Failing to use the correct syntax when declaring a flexible array member can result in undefined behavior 59, although the incorrect syntax will work on most implementations.
Rule | Severity | Likelihood | Detectable | RepairableRemediation Cost | Priority | Level |
|---|---|---|---|---|---|---|
DCL38-C | Low | Unlikely | Yes | YesLow | P3 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Astrée |
| array_out_of_bounds | Supported Astrée reports all out-of-bounds array access. | ||||||
| Axivion Bauhaus Suite |
| CertC-DCL38 | Detects if the final member of struct which is declared as an array of small bound, is used as a flexible array member. | ||||||
| Compass/ROSE | Can detect some violations of this rule. In particular, it warns if the last element of a | ||||||||
| Cppcheck Premium |
| premium-cert-dcl38-c | |||||||
| Helix QAC |
| C1037, C1039 | Fully implemented | ||||||
| Klocwork |
| CERT.STRUCT.FLEXIBLE_ARRAY_MEMBER | Fully implemented | ||||||
| LDRA tool suite |
| 648 S | Fully implemented | ||||||
| Parasoft C/C++test |
| CERT_C-DCL38-a | The final member of a structure should not be an array of size '0' or '1' | ||||||
| PC-lint Plus |
| 9040 | Fully supported | ||||||
| Polyspace Bug Finder |
| CERT C: Rule DCL38-C | Checks for incorrect syntax of flexible array member size (rule fully covered) | ||||||
| TrustInSoft Analyzer |
| index_bound | Exhaustively detects out-of-bounds array access (see the compliant and the non-compliant example). |
...