Study of Statically Detecting Resource Leak in C/C++ Program

Author
MaHongGang
Advisor
LiuJian
School
Xi'an University of Electronic Science and Technology
Major
Computer Software and Theory
Classification
TP312.1 Programming language ALGOL
Degree
Master's thesis
Year
2006
Downloads
120
Citations
0

Request the full text

Abstract

Statically detect resource leak in C/C++ program is studied in this paper. In order to find out safety flaws in C/C++ program and improve the safety performance of software, a method to statically detect resource leak is designed and implemented. Based on analyzing intermediate representation files generated by GCC compiler after semantic analyzer, according to the safety rules by record the resource application and release, resource leak vulnerabilities are detected.First, the representations of resource leak are classified. The syntax directed translation method is adopted to construct safety rules. Second, pointer node and resource node is designed to record the usage of resource. Flow-sensitive analysis is used to treat with conditional statements, with which the dynamic execution of program is simulated. The bottom up analysis is adopted by interprocedural check. Finally, combined with specific nodes of abstract syntax tree, safety analysis algorithms are described and the statically detection tool is implemented. The method proposed in this paper was implemented in XDCHECK, a statically checking tool for C/C++ program, experimental results illustrate that this method is effective.

Table of contents

Abstract 3-4 Abstract 4-7 The first chapter 7-11 1.1 Background 7-8 1.2 resource leak checks Research 8 1.3 The main thesis work and organizational structure 8-11 Chapter Two general overview 11-15 2.1 system design ideas 11-12 2.2.1 GCC intermediate representation based on the analysis of 11 2.2.2 Bottom-up analysis 11-12 2.2 Safety Analysis inspector general framework 12-15 Chapter resource leak check analysis and design 15-31 3.1 resource leaks and causes performance analysis 15-17 3.1.1 resource leak performance and classification 15-17 3.1.2 Analysis of the causes of resource leaks 17 3.2 within a resource leak checking process analysis and design 17-26 3.2.1 resource leaks within the process of checking the focus 17-18 3.2.2 resource leaks within the process of checking the security mode analysis 18-22 3.2.2.1 property design 18-19 3.2.2.2 vulnerabilities formal description 19-22 3.2.3 core data structure design 22-25 3.2.4 pointer aliasing processing 25 3.2.5 leak checking process resources within the core algorithm 25-26 3.3 Cross-process resource leak check analysis and design 26-31 3.3.1 Cross-process resource leak checks concern 26-27 3.3.2 Cross-process resource leak check the security mode analysis 27 3.3.3 core data structure design 27-31 Chapter resource leak checking implementation 31-43 4.1 control flow statement processing 31-34 4.1.1 control flow statements indicate 31-32 4.1.2 branch statement processing 32-33 4.1.3 loop handling 33-34 4.2 structure and multiple pointers processing 34-35 4.3 global variable handling 35-36 4.4 key node safety check algorithm 36-43 4.4.1 variable declaration node processing 36-38 4.4.2 assignment node processing 38-39 4.4.3 function call statement node processing 39-40 4.4.4 checks carried out at the end of the scope 40-43 Chapter case analysis 43-49 5.1 a control flow branching due to resource leaks caused by an instance of Analysis 43-45 5.2 a structure variable resource leak case analysis 45-46 5.3 a global variable resource leak case analysis 46-49 Conclusion 49-51 Thanks 51-53 References 53-55 during the reading of the research 55

Related dissertations

  1. Extension on the Defect Patterns of Java Language of Defect Testing System
  2. Statically Checking the Validity of Pointer Status in C/C++ Program
  3. Variable Cross-Section for Prsstrseeed Concrete-Rigid-Frame Bridge Portfolio System (West-yang River Bridge) Design and Research
    HanDaQian ·Taiyuan University of Technology ·2009 ·Master's thesis