The product does not handle or incorrectly handles an exceptional condition.
Common Consequences 1
Scope: Other
Impact: Other
Demonstrative Examples 3
ID : DX-39
The following example attempts to resolve a hostname.
Code Example:
Bad
Java
java
A DNS lookup failure will cause the Servlet to throw an exception.
ID : DX-201
The following example attempts to allocate memory for a character. After the call to malloc, an if statement is used to check whether the malloc function failed.
Code Example:
Bad
C
c
The conditional successfully detects a NULL return value from malloc indicating a failure, however it does not do anything to handle the problem. Unhandled errors may have unexpected results and may cause the program to crash or terminate.
Instead, the if block should contain statements that either attempt to fix the problem or notify the user that an error has occurred and continue processing or perform some cleanup and gracefully terminate the program. The following example notifies the user that the malloc function did not allocate the required memory resources and returns an error code.
Code Example:
Good
C
c
ID : DX-202
The following code mistakenly catches a NullPointerException.
Code Example:
Bad
Java
java
Observed Examples 4
CVE-2023-41151SDK for OPC Unified Architecture (OPC UA) server has uncaught exception when a socket is blocked for writing but the server tries to send an error
CVE-2021-3011virtual interrupt controller in a virtualization product allows crash of host by writing a certain invalid value to a register, which triggers a fatal error instead of returning an error code