...
Slicing results in information loss, which could lead to abnormal program execution or denial-of-service attacks.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
OOP51-CPP | Low | Probable | Medium | P4 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
CodeSonar |
| LANG.CAST.OBJSLICE | Object Slicing | ||||||
Helix QAC |
| C++3072 | |||||||
Parasoft C/C++test |
|
|
|
3072
CERT_CPP-OOP51-a | Avoid slicing function arguments / return value | ||||||||
Polyspace Bug Finder |
| CERT C++: OOP51-CPP | Checks for object slicing (rule partially covered) | ||||||
PVS-Studio |
| V1054 |
Related Vulnerabilities
Search for other vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
SEI CERT C++ Coding Standard | ERR61-CPP. Catch exceptions by lvalue reference |
SEI CERT C Coding Standard |
Bibliography
[Dewhurst 2002] | Gotcha #38, "Slicing" |
[ISO/IEC 14882-2014] | Subclause 12.8, "Copying and Moving Class Objects" |
[Sutter 2000] | Item 40, "Object Lifetimes—Part I" |
...
...