Deep Learning Based Identification of Suspicious Return Statements

Guangjie Li, Hui Liu*, Jiahao Jin, Qasim Umer

*Corresponding author for this work

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

9 Citations (Scopus)

Abstract

Identifiers in source code are composed of terms in natural languages. Such terms, as well as phrases composed of such terms, convey rich semantics that could be exploited for program analysis and comprehension. To this end, in this paper we propose a deep learning based approach, called MLDetector, to identifying suspicious return statements by leveraging semantics conveyed by the natural language phrases that are used as identifiers in the source code. We specially design a deep neural network to tell whether a given return statement matches its corresponding method signature. The rationale is that both method signature and return value should explicitly specify the output of the method, and thus a significant mismatch between method signature and return value may suggest a suspicious return statement. To address the challenge of lacking negative training data, i.e., incorrect return statements, we generate negative training data automatically by transforming real-world correct return statements. To feed code into neural network, we convert them into vectors by Word2Vec, an unsupervised neural network based learning algorithm. We evaluate the proposed approach in two parts. In the first part, we evaluate it on 500 open-source applications by automatically generating labeled training data. Results suggest that the precision of the proposed approach varies from 83% to 90%. In the second part, we conduct a case study on 100 real-world applications. Evaluation results suggest that 42 out of 65 real-world incorrect return statements are detected (with precision of 59%).

Original languageEnglish
Title of host publicationSANER 2020 - Proceedings of the 2020 IEEE 27th International Conference on Software Analysis, Evolution, and Reengineering
EditorsKostas Kontogiannis, Foutse Khomh, Alexander Chatzigeorgiou, Marios-Eleftherios Fokaefs, Minghui Zhou
PublisherInstitute of Electrical and Electronics Engineers Inc.
Pages480-491
Number of pages12
ISBN (Electronic)9781728151434
DOIs
Publication statusPublished - Feb 2020
Event27th IEEE International Conference on Software Analysis, Evolution, and Reengineering, SANER 2020 - London, Canada
Duration: 18 Feb 202021 Feb 2020

Publication series

NameSANER 2020 - Proceedings of the 2020 IEEE 27th International Conference on Software Analysis, Evolution, and Reengineering

Conference

Conference27th IEEE International Conference on Software Analysis, Evolution, and Reengineering, SANER 2020
Country/TerritoryCanada
CityLondon
Period18/02/2021/02/20

Keywords

  • Bug Detection
  • Code Quality
  • Deep Learning
  • Identification
  • Program Analysis
  • Return Value

Fingerprint

Dive into the research topics of 'Deep Learning Based Identification of Suspicious Return Statements'. Together they form a unique fingerprint.

Cite this