C/C++程序缺陷自动修复与确认方法
作者:
作者单位:

作者简介:

周风顺(1993-),男,江苏无锡人,硕士生,CCF学生会员,主要研究领域为软件分析,软件测试;李宣东(1963-),男,博士,教授,博士生导师,CCF会士,主要研究领域为软件工程;王林章(1973-),男,博士,教授,博士生导师,CCF杰出会员,主要研究领域为模型驱动的软件测试与验证,安全测试,软件测试自动化.

通讯作者:

王林章,E-mail:lzwang@nju.edu.cn

中图分类号:

基金项目:

国家重点研发计划(2016YFB1000802);国家自然科学基金(61632015)


Automatic Defect Repair and Validation Approach for C/C++ Programs
Author:
Affiliation:

Fund Project:

National Key Research and Development Program of China (2016YFB1000802); National Natural Science Foundation of China (61632015)

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    在计算机软件中,程序缺陷不可避免且极有可能造成重大损失.因此,尽早发现并排除程序中潜在的缺陷,是学术界和工业界的普遍共识.目前的程序缺陷自动修复方法大都遵循缺陷定位、修复候选项生成、选择及验证的流程,但在修复实际程序时存在修复率低、无法保证修复结果的正确性等问题.提出了一种基于程序合成的C/C++程序缺陷自动修复方法.首先,从满足相同规约的程序集中,通过人工整理的方式总结错误模式及其对应的修复方法,使用重写规则表达错误模式,在此基础上实现了基于重写规则和基于程序频谱的缺陷定位方法,得到程序中可能的缺陷位置;其次,基于重写规则,使用修复选项生成方法得到缺陷的修复选项,同时,通过深度学习的方式学习正确程序的书写结构,帮助预测错误程序错误点应有的语句结构,通过这两种方式提高候选项质量,进而提高修复率;最后,在选择验证过程中,使用程序合成的方法将样例程序作为约束,保证合成后代码的正确性.基于上述方法实现了原型工具AutoGrader,并在容易出错、缺陷典型的学生作业程序上进行了实验,结果显示,该方法对学生作业程序中的缺陷有着较高的修复率,同时也能保证修复后代码的正确性.

    Abstract:

    In computer software, program defects are inevitable and are highly likely to cause significant losses. Therefore, it is a common consensus in academia and industry to find and eliminate potential defects in the program as early as possible. Most of the current automatic program repair methods follow the process of defect location, candidate generation, candidate verification. However, when the program is repaired, there is a problem that the repair rate is low and the repair result cannot be guaranteed. This study proposes a method for automatic repair of defects in C/C++ program based on program synthesis. Firstly, the error mode and its corresponding repair methods are summarized from the assembly that satisfies the same specification, and use the rewrite rules to express the error mode and its corresponding repair methods. On this basis, a defect-location method is implemented based on rewrite rules and program spectrum to obtain possible defect locations in the program. Secondly, the candidate-generation method is used to get the repair candidate based on the rewrite rule. At the same time, the correct structure of the program through deep learning is learnt to help predict the correct sentence structure of the wrong program error point. These two ways improve the quality of the candidate and the repair rate. Finally, in the candidate-verification process, the method of program synthesis is used. The sample program is used as a constraint to ensure the correctness of the synthesized code. Based on the above methods, the prototype tool AutoGrader is implemented and it is experimented on student program. The experimental results show that the proposed method has a high repair rate for the defects in the student program, and also ensures the correctness of the code after the repair.

    参考文献
    相似文献
    引证文献
引用本文

周风顺,王林章,李宣东. C/C++程序缺陷自动修复与确认方法.软件学报,2019,30(5):1243-1255

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2018-09-01
  • 最后修改日期:2018-10-31
  • 录用日期:
  • 在线发布日期: 2019-05-08
  • 出版日期:
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号