Detecting method of unsafe variable use in software program

A software program and detection method technology, applied in the field of program analysis, can solve problems such as unsafe use, achieve the effects of improving reliability, improving code quality, and reducing development costs

Inactive Publication Date: 2011-01-05
INST OF SOFTWARE - CHINESE ACAD OF SCI
View PDF2 Cites 14 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0014] Aiming at the defect mode of unsafe use of variables in software programs, the present invention provides an automatic method for detecting program exception

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Detecting method of unsafe variable use in software program
  • Detecting method of unsafe variable use in software program
  • Detecting method of unsafe variable use in software program

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0058] Table 1 is a Java program. In addition to normal program statements, the program also includes try statement block, catch statement block and finally module. The try statement block is the warning area, and the catch statement block is the exception handling module. When the program is running, there may be exceptions in the statements in the 4th and 5th lines of the program. If an exception object of type IOException is thrown during the execution of the statement in the 5th line, the control flow will be transferred to the statement in the 8th line. The assignment to the variable str on line 5 is invalid. The program continues to execute, and the variable str is used by calling the str.length() method on line 14, which is an unsafe use of the variable str. Since the assignment to str in line 5 is unsuccessful, the value of str is still null, so when str is used in the statement in line 14, the program will throw an exception of type NullPointerException, resulting in ...

Embodiment 2

[0091] Table 3 is a section of Java program, which includes normal program statement, try statement block and finally module, does not contain catch statement block, and try statement block is a warning area.

[0092] Table 3 Example program fragment table of embodiment 2

[0093]

[0094] The method of detecting the use of unsafe variables of the program in Table 3 is:

[0095] S101, establish the control flow graph of the program in Table 3

[0096] A. Establish a normal execution path. Set the first and second statements in the program fragment in Table 3 as nodes and mark them with line numbers; establish a directed edge from node 1 to node 2; set the 14th line statement as node 14.

[0097] B. Establish the internal execution path of the try statement block in the alert area. Set each statement on lines 3-7 in the try block as a node. The execution sequence of the statements inside the try statement block is: starting from the statement on line 3, and executing to ...

Embodiment 3

[0112] Table 5 is a Java program, which includes a normal program statement, a try statement block and a catch statement block, excluding the finally module, the catch statement block is an exception handling module, and the try statement block is a warning area.

[0113] Table 5 Example program fragment table of embodiment 3

[0114]

[0115] The method for detecting the use of unsafe variables of the program in Table 5 is:

[0116] S101, establish the control flow graph of the program in Table 5

[0117] A. Establish a normal execution path. Set the first and second statements in the program fragment in Table 4 as nodes and mark them with line numbers; establish a directed edge from node 1 to node 2; set the 14th line statement as node 14.

[0118] B. Establish the internal execution path of the try statement block in the alert area. Set each statement on lines 3-7 in the try block as a node. The execution sequence of the statements inside the try statement block is: ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a detecting method of unsafe variable use in software program, belonging to the technical field of program analysis. The detecting method comprises the following steps: 1) establishing a control flowchart of a software program; 2) processing hierarchical dataflow analysis on the program according to the control flowchart to obtain the operation sequence of each variable of the program; and 3) checking whether each operation sequence has unsafe variable use. The detecting method of unsafe variable use in software program can quickly detect unsafe variable use, and can be used in early software development to find program defects, especially the defects of abnormal treatment codes as soon as possible, thereby improving code quality, improving software reliability and reducing software development cost.

Description

technical field [0001] The invention relates to a method for detecting software program defects, in particular to a method for detecting unsafe use of program variables related to abnormal processing in software, and belongs to the technical field of program analysis. Background technique [0002] The operation of a software program depends on a certain operating environment, and the operating environment directly affects the correctness of the software operating results. For example: the computer memory is exhausted during operation, which may cause the program to be forced to stop without producing correct execution results. This kind of program behavior that violates the expected normal execution is called a program exception. In order to improve the reliability of the software program and make the software program better adapt to the dynamically changing operating environment, it is necessary to add an exception handling module to the program during software design, and...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F11/36
Inventor 伍晓泉魏峻高楚舒
Owner INST OF SOFTWARE - CHINESE ACAD OF SCI
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products