Description
Catching NullPointerException should not be used as an alternative to programmatic checks to prevent dereferencing a null pointer.
Potential Impact
- Availability: DoS: Resource Consumption (CPU)
How to Fix
Architecture and Design
Do not extensively rely on catching exceptions (especially for validating user input) to handle errors. Handling exceptions can decrease the performance of an application.
Detection Methods
- Automated Static Analysis - Binary or Bytecode: According to SOAR [REF-1479], the following detection techniques may be useful:
Cost effective for partial coverage:
...
- Dynamic Analysis with Manual Results Interpretation: According to SOAR [REF-1479], the following detection techniques may be useful:
Cost effective for partial coverage:
...
- Manual Static Analysis - Source Code: According to SOAR [REF-1479], the following detection techniques may be useful:
Cost effective for partial coverage:
...
Related Weaknesses
References
View on MITRE CWE Database →