Partial Evaluation for Static Buffer Overflow Detection
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for detecting buffer overflows in code are often inefficient and provide less accurate results, as they typically require dynamic analysis and input data, which can lead to erratic program behavior and security breaches.
Innovation Solution
A method using partial evaluations that analyzes code prior to execution to generate a code segment with boundary tests, replacing access statements with conditional statements to determine if buffer bounds are exceeded, allowing for static and efficient overflow detection without requiring program input.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If dynamic analysis techniques are used to detect buffer overflows, then detection capability is provided, but analysis time increases and results become less accurate
Solution Approach 1:
The patent performs static analysis of the program code to identify buffer access patterns and potential overflow conditions before the program executes. By pre-computing boundary check conditions and analyzing memory access patterns during compilation, the system detects buffer overflows without requiring dynamic execution, thus reducing analysis time while maintaining accuracy.
Solution Approach 2:
The patent replaces dynamic execution-based detection with a static analysis approach. Instead of running the program and monitoring memory accesses during execution, the system uses compiler-based static analysis to determine buffer overflow conditions, substituting the mechanical process of dynamic testing with a more efficient static computation method.
2Loss of time
If static analysis techniques are used to detect buffer overflows, then analysis time is reduced, but detection accuracy decreases
Solution Approach 1:
The patent incorporates boundary check conditions that provide feedback about buffer state during static analysis. By computing and analyzing these boundary conditions alongside the program logic, the system receives feedback information about potential overflow states, enabling accurate detection while maintaining static analysis efficiency.
Solution Approach 2:
The patent changes the analysis parameters from simple execution monitoring to comprehensive boundary condition computation. By analyzing multiple parameters including buffer boundaries, access patterns, and index values during static analysis, the system achieves high detection accuracy without the time cost of dynamic execution.
3Speed
If partial evaluation is applied to optimize program execution, then execution speed increases, but the focus is on runtime optimization rather than static detection
Solution Approach 1:
The patent applies partial evaluation during the compilation phase to pre-compute boundary check conditions and optimize the static analysis process. By performing these evaluations before runtime, the system prepares optimized detection code that can efficiently identify buffer overflows without requiring complex runtime computations, thus improving both execution speed and detection efficiency.
Data Source
AI summary
A method for overflow detection using partial evaluations. The method includes obtaining a section of code from a source code file stored on a storage device, analyzing the section of code to identify a buffer with an index, determining a plurality of statements that are statically-computable and dependent on the index of the buffer, and generating a code segment including the plurality of statements. The method further includes replacing an access statement of the plurality of statements with a conditional statement returning true when bounds of the buffer are exceeded, where the access statement uses the index to access the buffer, adding an unconditional statement returning false to the code segment, and executing the code segment on a computer processor to obtain a determination of whether the bounds of the buffer are exceeded.


