跳到主要导航 跳到搜索 跳到主要内容

A Static Detection Method for Code Defects Based on Transformer

  • Shubin Yuan
  • , Chenyu Liu
  • , Jianheng Shi
  • , Xinyu Liu
  • , Wei Pu
  • , Juntao Yu
  • , Liqun Yang
  • China National Offshore Oil Corp

科研成果: 书/报告/会议事项章节会议稿件同行评审

摘要

With the continuous increase in the scale and complexity of computer software, code defects in software pose a serious threat to public security. A Static Detection Method for Code Defects Based on Transformer is proposed to address the issues of poor scalability of static analysis tools, as well as coarse detection granularity and unsatisfactory detection performance of existing methods. Firstly, perform data flow and control flow analysis on key points in the source code, and adopt a slicing method based on Interprocedural Finite Distributive Subset (IFDS) to obtain code fragments composed of multiple lines of statements related to code defects. Then, the word embedding method is used to obtain vector representations related to the semantics of the code snippets, in order to select the appropriate length of the code snippets while ensuring accuracy. Finally, use Transformer to detect the segment features at the slice level to determine whether the code has defects. The experimental results show that the proposed method can effectively detect different types of code defects, and the detection effect is significantly better than the static analysis tool Flawfender. Under fine-grained conditions, the IFDS slicing method can further improve F1 value and accuracy, reaching 89.64 and 92.08 respectively. It can be seen that the proposed method has better comprehensive detection performance without significantly increasing time complexity.

源语言英语
主期刊名CNCIT 2024 - 2024 3rd International Conference on Networks, Communications and Information Technology
出版商Association for Computing Machinery
104-111
页数8
ISBN(电子版)9798400717048
DOI
出版状态已出版 - 7 6月 2024
活动3rd International Conference on Networks, Communications and Information Technology, CNCIT 2024 - Xi'an, 中国
期限: 7 6月 20249 6月 2024

出版系列

姓名ACM International Conference Proceeding Series

会议

会议3rd International Conference on Networks, Communications and Information Technology, CNCIT 2024
国家/地区中国
Xi'an
时期7/06/249/06/24

学术指纹

探究 'A Static Detection Method for Code Defects Based on Transformer' 的科研主题。它们共同构成独一无二的学术指纹。

引用此