Code Relatives Detection via Instruction Dependency Graphs

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods fail to efficiently detect code relatives and clones across software libraries and APIs, especially in identifying processes with similar behavior despite differing code structures, which hinders code maintenance and plagiarism detection.

Innovation Solution

A method and system that generate instruction dependency graphs for code segments, using link analysis and subgraph isomorphism to determine similarity between processes, identifying code relatives by exceeding a pre-determined threshold, and employing a dynamic vector representation to compute similarity distances.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If traditional code similarity detection methods are used, then syntactically similar code can be identified, but processes with similar behavior but different code structures cannot be detected

Engineering Contradiction:
Improvecode similarity detection precisionVSAvoiddetection coverage for behaviorally similar code
Core Design Contradiction:
Measurement precisionVSAdaptability or versatility

Solution Approach 1:

The patent transforms code from static syntactic representation to dynamic behavioral representation by changing the analysis parameter from source code text to instruction dependency graphs generated during runtime execution. This allows detection of behaviorally similar code regardless of syntactic differences.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The patent replaces traditional text-based code comparison mechanisms with a graph-based dependency analysis system. Instead of mechanically comparing source code strings, the system constructs instruction dependency graphs that capture behavioral semantics, enabling detection of functionally equivalent code with different syntax.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

2Measurement precision

If comprehensive code analysis is performed to improve detection accuracy, then more code relatives can be identified, but time complexity increases significantly

Engineering Contradiction:
Improvecode relative detection accuracyVSAvoidanalysis time complexity
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent performs preliminary code instrumentation and static analysis before runtime execution to pre-compute and store instruction dependency information. This preliminary action reduces the computational burden during actual similarity detection, as the graph structures are already constructed and can be directly compared without re-analysis.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent segments the code analysis process into distinct phases: static instrumentation, runtime graph generation, and similarity comparison. By dividing the comprehensive analysis into manageable segments, the system can optimize each phase independently and avoid the need to perform all analyses simultaneously, reducing overall time complexity.

Inventive Principle:
Principle #1Segmentation

3Loss of information

If code representation is tied to specific code expression, then detailed code structure information is preserved, but program representations become expression-dependent and less generalizable

Engineering Contradiction:
Improvecode structure information retentionVSAvoidexpression independence
Core Design Contradiction:
Loss of informationVSAdaptability or versatility

Solution Approach 1:

The patent extracts the essential behavioral semantics from the code by generating instruction dependency graphs that separate functional behavior from syntactic expression. By taking out only the relevant dependency relationships and execution flow information, the system creates representations that are independent of the original code expression while preserving behavioral meaning.

Inventive Principle:
Principle #2Taking out (Extraction)

Data Source

PatentUS10459704B2Code relatives detection
Publication Date: 2019.10.29 THE TRUSTEES OF COLUMBIA UNIV IN THE CITY OF NEW YORK
  • US10459704B2 patent drawing
  • US10459704B2 patent drawing
  • US10459704B2 patent drawing

AI summary

Disclosed are devices, systems, apparatus, methods, products, media, and other implementations, including a method that includes generating for a code segment of a first process an instruction dependency graph representative of behavior of the first process, obtaining respective one or more instruction dependency graphs representative of behaviors of code segments for one or more other processes, and determining, based on the first instruction dependency graph for the first process and the respective one or more instruction dependency graphs for the one or more other processes, a level of similarity between the first process and at least one of the one or more other processes.