Automatic detection and positioning method for memory error in source code

A memory error and automatic detection technology, applied in the direction of code compilation, program code conversion, memory system, etc., can solve the problems of lack of platform universality, not easy to debug errors, and incompatibility with running platforms.

Active Publication Date: 2017-07-11
NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF3 Cites 24 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Since this technology is to modify the binary code, it does not have platform universality, that is, the modification tool can only process the binary code of the mainstream platform, but cannot be compa...

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
  • Automatic detection and positioning method for memory error in source code
  • Automatic detection and positioning method for memory error in source code
  • Automatic detection and positioning method for memory error in source code

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

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

[0146] In this embodiment, the method of the present invention is used to detect and locate the memory error of a piece of C language source code, and the related methods, processes and related steps of the present invention are further described in detail. For example, the source code is as follows (the file name is test.c):

[0147]

[0148]

[0149] The concrete steps of the present invention are as follows:

[0150] Step S1, select the source code directory that needs to be transformed, or a single source code file;

[0151] In this example, the source code file test.c is selected.

[0152] Step S2, copy the selected source code directory or file to the working directory of the source code conversion;

[0153] In this example, copy the source code file test.c to the working directory C: / work / (Windows system) or / tmp / work / (Linux system).

[015...

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 provides an automatic detection and positioning method for a memory error in a source code. The method comprises the steps of firstly using a compiler for carrying out lexical analysis and grammatical analysis on the source code, and constructing a symbol table and an abstract syntax tree; then through traversing the abstract syntax tree, carrying out source code transformation on a node which may produce the memory error, and finally compiling and executing the source code subjected to transformation, wherein a program can automatically judge the occurrence of the memory error, and accurately reports a source code position corresponding to the error. The automatic detection and positioning method for the memory error in the source code provided by the invention can be used for accurately automatically detecting and positioning the memory error so as to realize more comprehensive error detection, better compatibility, better platform universality, more accurate source code positioning, and higher runtime performance and efficiency, so that the quality of software and the efficiency of software maintenance are improved.

Description

technical field [0001] The invention relates to an automatic detection and location method for memory errors in source codes, belonging to the field of computer software, in particular to the field of computer software testing. Background technique [0002] A memory error is a common design flaw in C / C++ programs that can lead to abnormal software operation and security holes. Memory errors include space memory errors, time memory errors, and type memory errors. Space memory errors are also called buffer overflow errors, including: array out of bounds, pointer access out of bounds, pointer not initialized before use, dereference of null pointer, dereference of pointer obtained by forced type conversion of arbitrary integer data, etc.; time memory Errors include: dangling stack pointer, dangling heap pointer, multiple release, incomplete release, etc.; type memory errors include: releasing non-heap memory space, dereferencing function pointers as data pointers, and using dat...

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): G06F9/45
CPCG06F8/42G06F8/43G06F8/44
Inventor 陈哲严俊琦杨志斌黄志球
Owner NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
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