CWE一覧に戻る
CWE-395

NULLポインタ参照を検出するためのNullPointerExceptionキャッチの使用

Use of NullPointerException Catch to Detect NULL Pointer Dereference
脆弱性 レビュー中
JA

NullPointerExceptionをキャッチすることは、NULLポインタの再参照を防ぐためのプログラム的なチェックの代替として使用すべきではありません。

プログラマーは通常、以下の3つの状況でNullPointerExceptionをキャッチする:

この3つの状況のうち、許容できるのは最後の状況だけです。

EN

Catching NullPointerException should not be used as an alternative to programmatic checks to prevent dereferencing a null pointer.

Programmers typically catch NullPointerException under three circumstances:

Of these three circumstances, only the last is acceptable.

Scope: Availability / Impact: DoS: Resource Consumption (CPU)
Do not extensively rely on catching exceptions (especially for validating user input) to handle errors. Handling exceptions can decrease the performance of an application.
MITRE公式ページ — CWE-395