基于深度学习的API误用缺陷检测
作者:
作者单位:

作者简介:

汪昕(1996-),女,福建泉州人,硕士生,CCF学生会员,主要研究领域为智能化软件开发;彭鑫(1979-),男,博士,教授,博士生导师,CCF高级会员,主要研究领域为智能化软件开发,移动计算,云计算;陈驰(1993-),男,博士生,主要研究领域为代码推荐;赵文耘(1964-),男,博士,教授,博士生导师,CCF高级会员,主要研究领域为软件工程,智慧城市;赵逸凡(1995-),男,硕士生,CCF专业会员,主要研究领域为智能化软件开发.

通讯作者:

彭鑫,E-mail:pengxin@fudan.edu.cn

中图分类号:

基金项目:

国家重点研发计划(2016YFB1000801)


API Misuse Bug Detection Based on Deep Learning
Author:
Affiliation:

Fund Project:

National Key Research and Development Program of China (2016YFB1000801)

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

    开发人员经常需要使用各种应用程序编程接口(application programming interface,简称API)来复用已有的软件框架、类库等.由于API自身的复杂性、文档资料的缺失等原因,开发人员经常会误用API,从而导致代码缺陷.为了自动检测API误用缺陷,需要获得API使用规约,并根据规约对API使用代码进行检测.然而,可用于自动检测的API规约难以获得,而人工编写并维护的代价又很高.针对以上问题,将深度学习中的循环神经网络模型应用于API使用规约的学习及API误用缺陷的检测.在大量的开源Java代码基础上,通过静态分析构造API使用规约训练样本,同时利用这些训练样本搭建循环神经网络学习API使用规约.在此基础上,针对API使用代码进行基于上下文的语句预测,并通过预测结果与实际代码的比较发现潜在的API误用缺陷.对所提出的方法进行实现并针对Java加密相关的API及其使用代码进行了实验评估,结果表明,该方法能够在一定程度上实现API误用缺陷的自动发现.

    Abstract:

    Developers often need to use various application programming interfaces (API) to reuse existing software frameworks, class libraries, and so on. Because of the complexity of the API itself, or the lack of documentation, developers often make some API misuses, which can lead to some code defects. In order to automatically detect API misuse defects, the API use specification is required and the API is tested according to the specification. However, API specifications that can be used for automatic detection are difficult to obtain, and the cost of manual writing and maintenance is high. To address the issue, this study applies the recurrent neural network model of deep learning to the task of learning API use specifications and the task of detecting the API misuse defect. In this study, based on a large number of open source Java code, the training sample of API use specification is extracted based on static analysis method, and then use the training sample to set up the recurrent neural network to learning API use specification. On this basis, this study makes a context-based prediction on the API use code, and finds out the potential API misuse defects by comparing the prediction results with the actual code. The method above is implemented, and it is evaluated with experiments about Java encryption related APIs and their used code. The results show that the proposed approach has the ability to a certain extent to automatically detect API misuse defects.

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

汪昕,陈驰,赵逸凡,彭鑫,赵文耘.基于深度学习的API误用缺陷检测.软件学报,2019,30(5):1342-1358

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

京公网安备 11040202500063号