...
Throwing an exception copy-initializes a temporary object, called the exception object. The temporary is an lvalue and is used to initialize the variable declared in the matching handler.
If the copy constructor for the exception object type throws during the copy initialization, std::terminate()
is called, which can result in undefined possibly unexpected implementation-defined behavior. For more information on implicitly calling std::terminate()
, see ERR50-CPP. Do not abruptly terminate the program.
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
ERR60-CPP | Low | Probable | Medium | P4 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
Clang |
| cert-err60-cpp | Checked by clang-tidy |
Helix QAC |
| C++ |
3508 | |
Parasoft C/ |
C++test |
|
| CERT_CPP-ERR60-a | Exception objects must be nothrow copy constructible | |||||||
Polyspace Bug Finder |
| Checks for throwing exception object in copy constructor (rule fully covered) |
Related Vulnerabilities
Search for other vulnerabilities resulting from the violation of this rule on the CERT website.
...