...
If no matching handler is found, the function
std::terminate()is called; whether or not the stack is unwound before this call tostd::terminate()is implementation-defined.
The default terminate handler called by std::terminate() calls std::abort(), which abnormally terminates the process. When std::abort() is called, or if the implementation does not unwind the stack prior to calling std::terminate(), destructors for objects may not be called and external resources can be left in an indeterminate state. Abnormal process termination is the typical vector for denial-of-service attacks. For more information on implicitly calling std::terminate(), see ERR50-CPP. Do not abruptly terminate the program.
...
Allowing the application to abnormally terminate can lead to resources not being freed, closed, and so on. It is frequently a vector for denial-of-service attacks.
Rule | Severity | Likelihood |
|---|
Detectable | Repairable | Priority | Level |
|---|---|---|---|
ERR51-CPP | Low | Probable | Yes |
Yes |
P6 |
L2 |
Automated Detection
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Astrée |
| main-function-catch-all early-catch-all | Partially checked | ||||||
| Axivion Bauhaus Suite |
| CertC++-ERR51 | |||||||
| CodeSonar |
| LANG.STRUCT.UCTCH | Masked by handler | ||||||
| Helix QAC |
| C++4035, C++4036, C++4037 | |||||||
| Klocwork |
| MISRA.CATCH.ALL | |||||||
| LDRA tool suite |
| 527 S | Partially implemented | ||||||
| Parasoft C/C++test |
EXCEPT-13
| CERT_CPP-ERR51-a | Always catch exceptions | |||||||
| Polyspace Bug Finder |
| CERT C++: ERR51-CPP | Checks for unhandled exceptions (rule partially covered) | ||||||
| RuleChecker |
| main-function-catch-all early-catch-all | Partially checked | ||||||
| Security Reviewer - Static Reviewer |
| C35 | Fully implemented |
Related Vulnerabilities
Search for other vulnerabilities resulting from the violation of this rule on the CERT website.
...
This rule is a subset of ERR50-CPP. Do not abruptly terminate the program.
Bibliography
| [ISO/IEC 14882-2014] | Subclause 15.1, "Throwing an Exception" |
| [MISRA 2008] | Rule 15-3-2 (Advisory) Rule 15-3-4 (Required) |
...
...