CWE-586 对Finalize()的显式调用

admin 2021年11月4日23:16:14评论51 views字数 1138阅读3分47秒阅读模式

CWE-586 对Finalize()的显式调用

Explicit Call to Finalize()

结构: Simple

Abstraction: Variant

状态: Draft

被利用可能性: unkown

基本描述

The software 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.

相关缺陷

  • cwe_Nature: ChildOf cwe_CWE_ID: 1076 cwe_View_ID: 1000 cwe_Ordinal: Primary

  • cwe_Nature: ChildOf cwe_CWE_ID: 1076 cwe_View_ID: 699 cwe_Ordinal: Primary

适用平台

Language: {'cwe_Name': 'Java', 'cwe_Prevalence': 'Undetermined'}

常见的影响

范围 影响 注释
['Integrity', 'Other'] ['Unexpected State', 'Quality Degradation']

可能的缓解方案

['Implementation', 'Testing']

策略:

Do not make explicit calls to finalize(). Use static analysis tools to spot such instances.

示例代码

The following code fragment calls finalize() explicitly:

bad Java


// time to clean up

widget.finalize();

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
The CERT Oracle Secure Coding Standard for Java (2011) MET12-J Do not use finalizers
Software Fault Patterns SFP3 Use of an improper API

文章来源于互联网:scap中文网

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年11月4日23:16:14
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CWE-586 对Finalize()的显式调用http://cn-sec.com/archives/613094.html

发表评论

匿名网友 填写信息