Automatic Repair Method for Null Pointer Dereferences Guided by Program Dependency Graph

Automatic program repair (APR) is an effective technique for eliminating defects. The repair of null pointer dereferences, as the most common defects, requires accurate dependencies among statements to determine where to repair and how to repair. In order to precisely identify the data and control d...

Full description

Bibliographic Details
Main Authors: Yukun Dong, Yuxue Sun, Xun Wang
Format: Article
Language:English
Published: MDPI AG 2022-07-01
Series:Symmetry
Subjects:
Online Access:https://www.mdpi.com/2073-8994/14/8/1555
_version_ 1797407774766792704
author Yukun Dong
Yuxue Sun
Xun Wang
author_facet Yukun Dong
Yuxue Sun
Xun Wang
author_sort Yukun Dong
collection DOAJ
description Automatic program repair (APR) is an effective technique for eliminating defects. The repair of null pointer dereferences, as the most common defects, requires accurate dependencies among statements to determine where to repair and how to repair. In order to precisely identify the data and control dependencies, the program dependency graph is adopted. Based on the symmetry among a large number of patches, we propose four repair mechanisms in this passage, namely the assignment mechanism, restraint mechanism, evading mechanism, and transfer mechanism, and employ the decision tree algorithm to match the best repair mechanism for defects. The four repair mechanisms locate the accurate repair position using the program dependency graph, and generate candidate patches by reassigning the null pointer with an appropriate value, making a judgment for the null value in advance, or throwing an exception. Our method was implemented in the repair tool DTSFix, which supports the automatic repair of null pointer dereference in Java programs. The experimental result on Defects4J shows that 73% of null pointer dereferences are successfully repaired by DTSFix, and that the generated candidate patches do not contain over-fitting patches.
first_indexed 2024-03-09T03:47:26Z
format Article
id doaj.art-7d0a05aa278e4ae6bc7ea4ff9fe1fb6b
institution Directory Open Access Journal
issn 2073-8994
language English
last_indexed 2024-03-09T03:47:26Z
publishDate 2022-07-01
publisher MDPI AG
record_format Article
series Symmetry
spelling doaj.art-7d0a05aa278e4ae6bc7ea4ff9fe1fb6b2023-12-03T14:32:48ZengMDPI AGSymmetry2073-89942022-07-01148155510.3390/sym14081555Automatic Repair Method for Null Pointer Dereferences Guided by Program Dependency GraphYukun Dong0Yuxue Sun1Xun Wang2College of Computer Science and Technology, China University of Petroleum, Qingdao 266580, ChinaCollege of Computer Science and Technology, China University of Petroleum, Qingdao 266580, ChinaCollege of Computer Science and Technology, China University of Petroleum, Qingdao 266580, ChinaAutomatic program repair (APR) is an effective technique for eliminating defects. The repair of null pointer dereferences, as the most common defects, requires accurate dependencies among statements to determine where to repair and how to repair. In order to precisely identify the data and control dependencies, the program dependency graph is adopted. Based on the symmetry among a large number of patches, we propose four repair mechanisms in this passage, namely the assignment mechanism, restraint mechanism, evading mechanism, and transfer mechanism, and employ the decision tree algorithm to match the best repair mechanism for defects. The four repair mechanisms locate the accurate repair position using the program dependency graph, and generate candidate patches by reassigning the null pointer with an appropriate value, making a judgment for the null value in advance, or throwing an exception. Our method was implemented in the repair tool DTSFix, which supports the automatic repair of null pointer dereference in Java programs. The experimental result on Defects4J shows that 73% of null pointer dereferences are successfully repaired by DTSFix, and that the generated candidate patches do not contain over-fitting patches.https://www.mdpi.com/2073-8994/14/8/1555automatic program repairnull pointer dereferenceprogram dependency graphprogram patchdecision tree
spellingShingle Yukun Dong
Yuxue Sun
Xun Wang
Automatic Repair Method for Null Pointer Dereferences Guided by Program Dependency Graph
Symmetry
automatic program repair
null pointer dereference
program dependency graph
program patch
decision tree
title Automatic Repair Method for Null Pointer Dereferences Guided by Program Dependency Graph
title_full Automatic Repair Method for Null Pointer Dereferences Guided by Program Dependency Graph
title_fullStr Automatic Repair Method for Null Pointer Dereferences Guided by Program Dependency Graph
title_full_unstemmed Automatic Repair Method for Null Pointer Dereferences Guided by Program Dependency Graph
title_short Automatic Repair Method for Null Pointer Dereferences Guided by Program Dependency Graph
title_sort automatic repair method for null pointer dereferences guided by program dependency graph
topic automatic program repair
null pointer dereference
program dependency graph
program patch
decision tree
url https://www.mdpi.com/2073-8994/14/8/1555
work_keys_str_mv AT yukundong automaticrepairmethodfornullpointerdereferencesguidedbyprogramdependencygraph
AT yuxuesun automaticrepairmethodfornullpointerdereferencesguidedbyprogramdependencygraph
AT xunwang automaticrepairmethodfornullpointerdereferencesguidedbyprogramdependencygraph