...
Passing a pointer value to a deallocation function that was not previously obtained by the matching allocation function results in undefined behavior, which can lead to exploitable vulnerabilities.
Rule | Severity | Likelihood |
|---|
Detectable | Repairable | Priority | Level |
|---|---|---|---|
MEM56-CPP | High | Likely | No |
No |
P9 |
L2 |
Automated Detection
Tool | Version | Checker | Description |
|---|
| Astrée |
| dangling_pointer_use | |||||||
| Axivion Bauhaus Suite |
| CertC++-MEM56 | |||||||
| Helix QAC |
| DF4721, DF4722, DF4723 | |||||||
| Klocwork |
| CERT.MEM.SMART_PTR.OWNED CERT.MEM.SMART_PTR.OWNED.THIS | |||||||
| Parasoft C/C++test |
| CERT_CPP-MEM56-a | Do not store an already-owned pointer value in an unrelated smart pointer | ||||||
| Polyspace Bug Finder |
| CERT C++: MEM56-CPP | Checks for use of already-owned pointers (rule fully covered) | ||||||
| |||||||||
| va_start_subsequentCalls | Fully implemented |
Related Vulnerabilities
Search for other vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
| SEI CERT C++ Coding Standard | MEM50-CPP. Do not access freed memory MEM51-CPP. Properly deallocate dynamically allocated resources |
| MITRE CWE | CWE-415, Double Free |
Bibliography
| [ISO/IEC 14882-2014] | Subclause 20.8, "Smart Pointers" |
...
...