TY - GEN
T1 - A Static Detection Method for Code Defects Based on Transformer
AU - Yuan, Shubin
AU - Liu, Chenyu
AU - Shi, Jianheng
AU - Liu, Xinyu
AU - Pu, Wei
AU - Yu, Juntao
AU - Yang, Liqun
N1 - Publisher Copyright:
© 2024 ACM.
PY - 2024/6/7
Y1 - 2024/6/7
N2 - 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.
AB - 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.
KW - defect detection
KW - program slicing
KW - transformer
UR - https://www.scopus.com/pages/publications/85201296625
U2 - 10.1145/3672121.3672141
DO - 10.1145/3672121.3672141
M3 - 会议稿件
AN - SCOPUS:85201296625
T3 - ACM International Conference Proceeding Series
SP - 104
EP - 111
BT - CNCIT 2024 - 2024 3rd International Conference on Networks, Communications and Information Technology
PB - Association for Computing Machinery
T2 - 3rd International Conference on Networks, Communications and Information Technology, CNCIT 2024
Y2 - 7 June 2024 through 9 June 2024
ER -