...
Attempting to destroy an array of polymorphic objects through the incorrect static type is undefined behavior. In practice, potential consequences include abnormal program execution and memory leaks.
Rule | Severity | Likelihood | Detectable | RepairableRemediation Cost | Priority | Level |
|---|---|---|---|---|---|---|
EXP51-CPP | Low | Unlikely | No | NoMedium | P2P1 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| -analyzer-checker=cplusplus | Checked with clang -cc1 or (preferably) scan-build | |||||||
| CodeSonar |
| ALLOC.TM | Type Mismatch | ||||||
| Helix QAC |
| C++3166 | |||||||
| Klocwork |
| CERT.EXPR.DELETE_ARR.BASE_PTR MISRA.CATCH.WRONGORD | |||||||
| Parasoft C/C++test |
| CERT_CPP-EXP51-a | Do not treat arrays polymorphically | ||||||
| Parasoft Insure++ | Runtime detection | ||||||||
| Polyspace Bug Finder |
| CERT C++: EXP51-CPP | Checks for delete operator used to destroy downcast object of different type. |
Related Vulnerabilities
Search for other vulnerabilities resulting from the violation of this rule on the CERT website.
...