系统工程与电子技术

• 软件、算法与仿真 • 上一篇    

基于复用代码检测的缺陷发现方法

常超1, 刘克胜2, 赵军2, 黄宁1   

  1. (1. 电子工程学院博士生队, 安徽 合肥 230037;
    2. 电子工程学院网络系, 安徽 合肥 230037)
  • 出版日期:2017-08-28 发布日期:2010-01-03

Clone flaw detection method based on clone code detection

CHANG Chao1, LIU Kesheng2, ZHAO Jun2, HUANG Ning1   

  1. (1. Doctoral Student Team, Electronics Engineering Institute of PLA, Hefei 230037, China;
    2. Department of Network, Electronics Engineering Institute of PLA, Hefei 230037, China)
  • Online:2017-08-28 Published:2010-01-03

摘要:

软件开发中,因代码复用导致复用缺陷的现象时常发生,针对此提出一种基于代码复用检测的缺陷发现方法。首先通过代码比对或补丁还原的方式定位缺陷相关的代码,将缺陷代码和待测代码以函数为单位进行划分,提取并量化各函数的度量特征、结构特征和文本特征,采用递进式相似函数逐轮筛选的方式,确定可能存在复用缺陷的函数,并基于模型检测和数据流分析技术对疑似缺陷进一步判断。实验选取典型开源项目进行测试,发现了多处潜在的复用缺陷,结果证明了所提方法的有效性,同时发现每个缺陷平均要对2~5个可能的复用点进行判断。

Abstract:

In software development, clone flaw phenomena caused by code clone occur at intervals. A method based on code clone detection was proposed to detect the clone flaws. The code area related to the flaw was located by code comparison or patch restoration. The flaw code and testing code were divided into functions as the analysis unit. By selecting and quantifying the metric feature, structure feature and text feature for every function, functions those may have clone flaws were identified using the progressive similar function filtration way. These suspected flaws were ensured using model checking and data-flow analysis. In the experiment with several typical open source projects, a number of clone flaws were detected. The results validate the effectiveness of the proposed method. Furthermore, a conclusion was drawn that when finding a flaw, averaging 2-5 clone points should be checked.