CWE一覧に戻る
CWE-586

Finalize() の明示的な呼び出し

Explicit Call to Finalize()
脆弱性 レビュー中
JA

この製品は、ファイナライザの外側から finalize() メソッドを明示的に呼び出します。

Java言語仕様では、オブジェクトのfinalize()メソッドをファイナライザの外から呼び出すことを認めていますが、通常、そうするのは悪い考えです。たとえば、明示的にfinalize()を呼び出すことは、finalize()が複数回呼び出されることを意味します。最初の呼び出しは明示的な呼び出しで、最後の呼び出しはオブジェクトがガベージコレクションされた後に行われます。

EN

The product makes an explicit call to the finalize() method from outside the finalizer.

While the Java Language Specification allows an object's finalize() method to be called from outside the finalizer, doing so is usually a bad idea. For example, calling finalize() explicitly means that finalize() will be called more than once: the first time will be the explicit call and the last time will be the call that is made after the object is garbage collected.

Scope: Integrity, Other / Impact: Unexpected State; Quality Degradation
Do not make explicit calls to finalize(). Use static analysis tools to spot such instances.
MITRE公式ページ — CWE-586