This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org

Difference between revisions of "Code Correctness: Erroneous finalize() Method"

From OWASP
Jump to: navigation, search
Line 1: Line 1:
 
{{Template:Vulnerability}}
 
{{Template:Vulnerability}}
 
{{Template:Fortify}}
 
{{Template:Fortify}}
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''
 
  
[[ASDR_TOC_Vulnerabilities|Vulnerabilities Table of Contents]]
+
__TOC__
  
 
[[ASDR Table of Contents]]
 
[[ASDR Table of Contents]]
__TOC__
+
 
 +
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''
 +
 
  
 
==Description==
 
==Description==
Line 84: Line 85:
 
[[Category:Code Snippet]]
 
[[Category:Code Snippet]]
 
[[Category:API Abuse]]
 
[[Category:API Abuse]]
 +
[[Category:Vulnerability]]

Revision as of 11:58, 29 October 2008

This is a Vulnerability. To view all vulnerabilities, please see the Vulnerability Category page.

This article includes content generously donated to OWASP by MicroFocus Logo.png

ASDR Table of Contents

Last revision (mm/dd/yy): 10/29/2008


Description

This finalize() method does not call super.finalize().

The Java Language Specification states that it is a good practice for a finalize() method to call super.finalize().[1]
The statement above is not completely correct. The Java Language Specification 3.0 section 12.6.1 states: "This should always be done, unless it is the programmer's intent to nullify the actions of the finalizer in the superclass."

Risk Factors

TBD

Examples

The following method omits the call to super.finalize().

 protected void finalize() {
                discardNative();
 }

Related Attacks


Related Vulnerabilities


Related Controls

Related Technical Impacts


References

  • [1] J. Gosling, B. Joy, G. Steele, G. Bracha. The Java Language Specification, Second Edition. Addison-Wesley, 2000.