CWE-584 — Return Inside Finally Block
CWE-584: Return Inside Finally Block
MITRE CWE weakness
| Kind | Weakness |
| Abstraction | Base |
| Status | Draft |
| Likelihood of exploit | — |
Description
The code has a return statement inside a finally block, which will cause any thrown exception in the try block to be discarded.
Common consequences
- Other: Alter Execution Logic
Mitigations
Implementation — Do not use a return statement inside the finally block. The finally block should have "cleanup" code.
References
- CWE page: https://cwe.mitre.org/data/definitions/584.html
- CWE list: https://cwe.mitre.org/data/index.html