Code static detection method

A static detection and code technology, applied in the field of giving program variable symbols initial values, can solve problems such as supporting a single language and not being able to handle pointers and aliases well

Active Publication Date: 2015-10-07
UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF4 Cites 25 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0008] The present invention provides a code static detection method aiming at the deficiencies of the prior art, and solves the problem that the static detection method in the current technology supports a single language, cannot handle pointers and aliases well, and detects potential program loopholes, etc.

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
  • Code static detection method
  • Code static detection method
  • Code static detection method

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0108] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0109] A code static detection method, the steps are as follows:

[0110] (1) Obtain the source code, and convert the source code into an LLVM assembler by preprocessing; that is, call the clang compiler to obtain the c / c++ / object-c source code, and convert the source code into an LLVM assembler by preprocessing; The specific steps of preprocessing and converting the source code into LLVM assembler are as follows:

[0111] (11) Invoke the compiler clang to check whether there are grammatical errors in the c / c++ / object-c source code. If there is an error, modify the grammatical error until the compiler does not report an error, so as to obtain the grammatically correct source code;

[0112] (12) Convert the obtained source code with correct syntax into LLVM assembler using compiler Clang.

[0113] (2) Use the symbolic execution algorithm to...

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 code static detection method, particularly relates to an LLVM IR (low level virtual machine intermediate representation) based symbol execution algorithm in the technical field of utilization of initial values of variable symbols of given programs, and solves the problems of single supported language and incapability of better processing pointers and aliases for a static detection method in the prior art and the problems in detecting potential program bugs and the like. The method comprises the steps of: (1) obtaining a source code, and preprocessing and converting the source code into an LLVM assembly program; (2) simulating interpretive execution of the LLVM assembly program obtained by conversion by applying the symbol execution algorithm, and recording the symbol value of each variable in different paths and the constraint conditions of each path; and (3) according to the recorded symbol value of each variable in different paths and constraint conditions of each path, calling an SMT (satisfiability modulo theories) solver Z3 to check whether the symbol value of the variable meets the path constraint and the bug constraint, and judging whether the program has potential bugs. The method is applied to array bound overflow, division by zero and null pointer dereference.

Description

technical field [0001] A code static detection method, applied to array out of bounds, division by zero errors and null pointer references in source code, involving compiler theory, program memory model, SMT constraint solving, formal methods, first-order predicate logic and other fields, specifically related to A symbolic execution algorithm based on LLVM IR - the technical field of using the symbolic initial value given to program variables. Background technique [0002] With the development of computer technology, software systems have been applied to all aspects of our lives. Relying on the Internet, we can shop online (Taobao / Jingdong), receive distance education (coursera / NetEase open class), chat with friends ( QQ / WeChat), and even see a doctor online. [0003] On September 19, 2014, Alibaba officially launched an IPO on the New York Stock Exchange in the United States. Its market value surpassed that of Facebook and became the second largest Internet company in the ...

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 Applications(China)
IPC IPC(8): G06F11/36
Inventor 屈鸿王晓斌李奇军符明晟邵领王留帅袁健
Owner UNIV OF ELECTRONICS SCI & TECH OF CHINA
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