...
| Code Block | ||||
|---|---|---|---|---|
| ||||
// classesClasses used for exception handling. class B {}; class D : public B {}; void f() { try { // ... } catch (B &b) { // ... } catch (D &d) { // ... } } |
Compliant Solution
In this compliant solution, the first handler will catch all exceptions of class D, and the second handler will catch all the other exceptions of class B.
| Code Block | ||||
|---|---|---|---|---|
| ||||
// classesClasses used for exception handling. class B {}; class D : public B {}; void f() { try { // ... } catch (D &d) { // ... } catch (B &b) { // ... } } |
Risk Assessment
Exception handlers with inverted priorities cause unexpected control flow when an exception occurs of the derived type.
...
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| CP1.ERR36 | Fully implemented | |||||||
| PRQA QA-C++ |
| 4040,4034 |
Related Vulnerabilities
...