DeepBugs: A Learning Approach to Name-based Bug Detection

04/30/2018
by   Michael Pradel, et al.
0

Natural language elements in source code, e.g., the names of variables and functions, convey useful information. However, most existing bug detection tools ignore this information and therefore miss some classes of bugs. The few existing name-based bug detection approaches reason about names on a syntactic level and rely on manually designed and tuned algorithms to detect bugs. This paper presents DeepBugs, a learning approach to name-based bug detection, which reasons about names based on a semantic representation and which automatically learns bug detectors instead of manually writing them. We formulate bug detection as a binary classification problem and train a classifier that distinguishes correct from incorrect code. To address the challenge that effectively learning a bug detector requires examples of both correct and incorrect code, we create likely incorrect code examples from an existing corpus of code through simple code transformations. A novel insight learned from our work is that learning from artificially seeded bugs yields bug detectors that are effective at finding bugs in real-world code. We implement our idea into a framework for learning-based and name-based bug detection. Three bug detectors built on top of the framework detect accidentally swapped function arguments, incorrect binary operators, and incorrect operands in binary operations. Applying the approach to a corpus of 150,000 JavaScript files yields bug detectors that have a high accuracy (between 89 very efficient (less than 20 milliseconds per analyzed file), and reveal 102 programming mistakes (with 68

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/28/2019

Using Distributed Representation of Code for Bug Detection

Recent advances in neural modeling for bug detection have been very prom...
research
07/14/2021

DeepMutants: Training neural bug detectors with contextual mutations

Learning-based bug detectors promise to find bugs in large code bases by...
research
07/29/2021

Learning how to listen: Automatically finding bug patterns in event-driven JavaScript APIs

Event-driven programming is widely practiced in the JavaScript community...
research
05/27/2023

WELL: Applying Bug Detectors to Bug Localization via Weakly Supervised Learning

Bug localization, which is used to help programmers identify the locatio...
research
06/01/2019

Neural Bug Finding: A Study of Opportunities and Challenges

Static analysis is one of the most widely adopted techniques to find sof...
research
04/21/2022

On Distribution Shift in Learning-based Bug Detectors

Deep learning has recently achieved initial success in program analysis ...
research
01/02/2023

Asteria-Pro: Enhancing Deep-Learning Based Binary Code Similarity Detection by Incorporating Domain Knowledge

The widespread code reuse allows vulnerabilities to proliferate among a ...

Please sign up or login with your details

Forgot password? Click here to reset