A statistical approach for finding property-access errors

06/14/2023
by   Ellen Arteca, et al.
0

We study the problem of finding incorrect property accesses in JavaScript where objects do not have a fixed layout, and properties (including methods) can be added, overwritten, and deleted freely throughout the lifetime of an object. Since referencing a non-existent property is not an error in JavaScript, accidental accesses to non-existent properties (caused, perhaps, by a typo or by a misunderstanding of API documentation) can go undetected without thorough testing, and may manifest far from the source of the problem. We propose a two-phase approach for detecting property access errors based on the observation that, in practice, most property accesses will be correct. First a large number of property access patterns is collected from an extensive corpus of real-world JavaScript code, and a statistical analysis is performed to identify anomalous usage patterns. Specific instances of these patterns may not be bugs (due, e.g., dynamic type checks), so a local data-flow analysis filters out instances of anomalous property accesses that are safe and leaves only those likely to be actual bugs. We experimentally validate our approach, showing that on a set of 100 concrete instances of anomalous property accesses, the approach achieves a precision of 82 suitable for practical use. We also conducted an experiment to determine how effective the popular VSCode code completion feature is at suggesting object properties, and found that, while it never suggested an incorrect property (precision of 100 cases (recall of 22.5 code completion alone to ensure that all property accesses are valid.

READ FULL TEXT

page 1

page 2

page 3

page 4

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
04/03/2022

A Study of Single Statement Bugs Involving Dynamic Language Features

Dynamic language features are widely available in programming languages ...
research
08/08/2020

Automated Functional Fuzzing of Android Apps

Android apps are GUI-based event-driven software and have become ubiquit...
research
12/14/2019

Conquering the Extensional Scalability Problem for Value-Flow Analysis Frameworks

With an increasing number of value-flow properties to check, existing st...
research
07/26/2022

Finding Deep-Learning Compilation Bugs with NNSmith

Deep-learning (DL) compilers such as TVM and TensorRT are increasingly u...
research
07/16/2020

Detecting Optimization Bugs in Database Engines via Non-Optimizing Reference Engine Construction

Database Management Systems (DBMS) are used ubiquitously. To efficiently...
research
03/10/2021

FiLiPo: A Sample Driven Approach for Finding Linkage Points between RDF Data and APIs (Extended Version)

Data integration is an important task in order to create comprehensive R...

Please sign up or login with your details

Forgot password? Click here to reset