Code Cloning Detection Using Normalized Basic Blocks

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Code cloning in software development often violates open source licenses and can introduce bugs or security defects, making it difficult to detect, especially in large open source software where modifications in function names, data types, and structures complicate identification.

Innovation Solution

An apparatus and method using a dictionary data structure to normalize and abstract source code functions, comparing them with a vulnerable code clone set to detect code cloning efficiently, reducing time complexity by using hash values and key searches.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If code cloning detection is performed using traditional methods on large open source software, then detection accuracy can be maintained, but detection time and computational complexity increase significantly

Engineering Contradiction:
Improvedetection accuracyVSAvoiddetection time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent segments the code comparison task by dividing functions into basic blocks and further into instruction sequences. This hierarchical segmentation allows the system to compare code at multiple levels of abstraction, maintaining detection accuracy while reducing the overall computational burden by processing smaller, manageable units rather than entire functions or files.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent extracts and compares only the essential structural and semantic features of code (basic blocks and instruction sequences) while ignoring non-essential elements like variable names and comments. This extraction approach maintains detection accuracy for cloned code while significantly reducing the data volume that needs to be processed and compared.

Inventive Principle:
Principle #2Taking out (Extraction)

2Adaptability or versatility

If traditional code comparison methods are used to detect code cloning with modifications in function names and data types, then all types of code cloning can be detected, but the detection process becomes increasingly complex and time-consuming

Engineering Contradiction:
Improvedetection coverageVSAvoiddetection complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent applies local quality by focusing comparison efforts on specific critical regions of code (basic blocks and instruction sequences) rather than uniformly analyzing entire functions. This allows the system to detect code cloning with modifications efficiently by concentrating computational resources on the most discriminative local features that remain consistent despite name and type changes.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent changes the parameters of comparison from high-level function signatures (names, return types) to low-level structural parameters (basic block sequences, instruction patterns). This parameter transformation enables the detection of code cloning even when function names and data types are modified, as the underlying structural parameters remain invariant across cloned code.

Inventive Principle:
Principle #35Parameter changes

3Reliability

If comprehensive code analysis is performed to detect code cloning in large software systems, then detection reliability is improved, but processing speed and efficiency decrease

Engineering Contradiction:
Improvedetection reliabilityVSAvoidprocessing speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent performs preliminary action by pre-processing code into standardized basic blocks and instruction sequences before comparison. This preliminary structuring organizes the code into a consistent format that facilitates reliable detection while speeding up subsequent comparison operations, as the heavy lifting of parsing and normalization is completed beforehand.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent creates simplified copies or representations of code (basic blocks as standardized structures) that preserve the essential cloning characteristics while discarding redundant information. These copied representations can be compared efficiently and reliably, maintaining detection accuracy while dramatically improving processing speed through reduced data complexity.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS10146532B2Apparatus and method for detecting code cloning of software
Publication Date: 2018.12.04 IOTCUBE INC
  • US10146532B2 patent drawing
  • US10146532B2 patent drawing
  • US10146532B2 patent drawing

AI summary

An apparatus for detecting code cloning of software includes a memory in which a program configured to detect code cloning from software is stored; and a processor configured to execute the program. Wherein the processor extracts multiple functions from a source code corresponding to the software, performs normalization and abstraction and compares the normalized and abstracted multiple functions with a vulnerable code clone set to determine whether there is code cloning of the software, and the vulnerable code clone set includes multiple vulnerable codes which are extracted from multiple functions included in other software, and normalized, abstracted and then stored.