Unlock instant, AI-driven research and patent intelligence for your innovation.

An Improved Method of Static Analysis Tool Based on Code Replacement and Regular Expression

A static analysis tool and expression technology, applied in the field of computer programming, can solve the problems of ignoring wrong typing, high false negative rate, compiler detection, etc., to reduce false negative rate, improve accuracy, and reduce costs. Effect

Active Publication Date: 2018-08-10
BEIJING INSTITUTE OF TECHNOLOGYGY
View PDF3 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0008] Existing static analysis tools have deficiencies in detecting plastic overflow problems involving self-increment and self-decrement operations, and the false positive rate is high, resulting in some serious defects not being discovered in time, affecting the stability of the system
In addition, the current static analysis tools do not take into account such problems as possible wrong typing. This kind of problem is very common in daily programming and cannot be detected by the compiler, and it is not easy to check manually, so it is up to the static analysis tool. It is very necessary to realize the inspection of such problems

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

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0018] Examples are given below to describe the present invention in detail.

[0019] Step (1), preprocessing

[0020] The main function of the preprocessing module is to preprocess the source code in the project file or project folder specified by the user, and generate intermediate code for syntax analysis.

[0021] The processing of the source code by the preprocessing module mainly includes four parts: traversing directories at all levels to obtain a list of files containing source code to be detected, combining header files and source code files, replacing auto-increment and auto-decrement operations, and performing macro definition preprocessing. The first of these steps is optional and only enabled if the input is a folder. An alternative to the third step is as follows:

[0022] i++=>((i=i+1)-1)

[0023] ++i=>(i=i+1)

[0024] i--=>((i=i-1)+1)

[0025] --i=>(i=i-1)

[0026] Take i++ replaced by ((i=i+1)-1) as an example, assuming i=3, i++ means to use i first, an...

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 present invention discloses a static analysis tool improvement method based on code substitution and a regular expression. A static analysis tool adopts a preprocessing module to preprocess a source code so as to generate an intermediate code; a grammar analysis module is adopted to perform grammar analysis on the intermediate code so as to finally obtain a bidirectional token link table; a defect mode matching module is adopted to compare the bidirectional token link table with a defect mode to find a matching part in the bidirectional token link table, and process the matching part to obtain a static analysis result; when the source code is preprocessed in the preprocessing module, (i=i+1)-1 is substituted for i++, i=i+1 is substituted for ++i, (i=i-1)+1 is substituted for i--, and i=i-1 is substituted for --i; and a regular expression is added in the defect mode matching module as follows: if(%var%=%num%), if(%any%&%any%), scanf(%str%,%var%), wherein %var%, %num%,%any%,%any%,%str% and %var% are all variables. The static analysis tool improvement method based on the code substitution and the regular expression provided by the present invention can improve the accuracy of an integer overflow problem, reduce a misreporting rate and reduce manual inspection costs.

Description

technical field [0001] The invention belongs to the technical field of computer programming, and in particular relates to a static analysis tool improvement method based on code replacement and regular expressions. Background technique [0002] The processing flow of the current static analysis tool can be divided into four parts: a preprocessing module, a syntax analysis module, a defect pattern matching module, and a defect pattern processing module. The source code in the project file or folder to be detected is first processed by a preprocessor to obtain an intermediate code that is easy to detect. The intermediate code is processed by the syntax analysis module to generate an abstract syntax tree. Then the defect pattern matching module matches the known defect patterns with the abstract syntax tree to detect the defects. The detected defects form a formatted output through the defect location and output module, and generate operation results according to user require...

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
Patent Type & Authority Patents(China)
IPC IPC(8): G06F11/36
CPCG06F8/42G06F8/43
Inventor 胡昌振单纯于泽群蔡弘非王勇
Owner BEIJING INSTITUTE OF TECHNOLOGYGY