Source-Binary Code Matching Using Intermediate Representation Scoring
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing code matching approaches rely on line numbers and edit distance-based metrics, which fail due to compiler-induced changes and lack of shared vocabulary, and machine learning methods require abundant training data, leading to inefficiencies in code comparison.
Innovation Solution
A method and system that generate intermediate representations of source and binary code, compute equivalence and data dependencies, and refine matching scores using line number sorting to accurately match code fragments.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If line number-based matching is used, then the matching process is simple, but it fails due to compiler-induced changes
Solution Approach 1:
The patent introduces an intermediate representation (IR) as a mediator between source code and binary code. The IR captures semantic information that is invariant to compiler transformations, allowing accurate matching without relying on fragile line number correspondence. The IR serves as a stable intermediary that preserves program semantics through compilation.
Solution Approach 2:
The patent transforms the matching parameters from superficial features (line numbers, text similarity) to deep semantic features (control flow graphs, data flow dependencies, intermediate representation). This parameter transformation enables matching to remain accurate despite compiler-induced changes in code structure and vocabulary.
2Ease of manufacture
If edit distance-based metrics are used, then the comparison process is straightforward, but it fails because source code and binary code do not share vocabulary
Solution Approach 1:
The intermediate representation serves as a common vocabulary that both source code and binary code can be translated into. This mediator enables meaningful comparison by expressing both forms in a unified semantic language, eliminating the vocabulary mismatch problem that plagues direct edit distance-based comparison.
Solution Approach 2:
The patent replaces the mechanical string-matching approach of edit distance with a semantic analysis approach using intermediate representations. Instead of comparing text sequences, the system compares semantic structures (control flow, data flow, type information) that are preserved through compilation, achieving accurate matching without relying on textual similarity.
3Measurement precision
If machine learning techniques are used, then code processing can be enhanced, but significant training data is required which is not available in abundance
Solution Approach 1:
The system uses self-service by automatically generating intermediate representations and extracting semantic features directly from the input code and binary files. This eliminates the need for external training data, as the method derives all necessary information from the code itself through deterministic semantic analysis rather than statistical learning.
Solution Approach 2:
The patent extracts essential semantic features (control flow structures, data flow dependencies, type information) from the code and binary files. By extracting these invariant semantic properties, the system achieves accurate matching without requiring large training datasets, focusing only on the critical features that preserve program meaning through compilation.
4Reliability
If compiler transformations are considered, then matching accuracy can be improved, but the complexity of the matching system increases significantly
Solution Approach 1:
The intermediate representation acts as a simplifying intermediary that abstracts away compiler complexity. By translating both source and binary code into this common IR form, the system handles compiler transformations uniformly without needing complex rules to account for each specific transformation, reducing overall system complexity while maintaining robustness.
Data Source
AI summary
State of the art code matching approaches have the disadvantage that they rely on the line numbers provided by source code and binary parsers to establish mapping and do not work since changes introduced by compiler may be much more complex. Some approaches do not work as the source code of application and its binary version may not share the vocabulary. Machine learning based techniques have the disadvantage that they require significant amount of training data, which may not be available in abundance. Method and system disclosed herein provide a mechanism matching score for each of a plurality of code fragments in the intermediate representation of the source code file for each of a plurality of binary fragments in the intermediate representation of the binary file.


