CWE-460 · Słabość
Improper Cleanup on Thrown Exception
- Abstrakcja
- Bazowa
- Status
- Szkic
- Ryzyko wykorzystania
- średnie
- Dodano
- 19 lipca 2006
- Ostatnia zmiana
- 11 grudnia 2025
Opis
The product does not clean up its state or incorrectly cleans up its state when an exception is thrown, leading to unexpected state or control flow.
Often, when functions or loops become complicated, some level of resource cleanup is needed throughout execution. Exceptions can disturb the flow of the code and prevent the necessary cleanup from happening.
Skutki
Other
Varies by Context
The code could be left in a bad state.
Zapobieganie
Implementation
If one breaks from a loop or function by throwing an exception, make sure that cleanup happens or that you should exit the program. Use throwing exceptions sparsely.
Słabość nadrzędna
Kiedy powstaje
- Implementation — REALIZATION: This weakness is caused during implementation of an architectural security tactic.
Dotyczy
C, C++, Java, C#
Źródła
- The CLASP Application Security Process — Secure Software, Inc., 2005
Wpis z katalogu CWE 4.20.