User-Defined Type Inference for Incomplete Code Analysis

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Static analysis of incomplete or partially missing user-defined types in application program code leads to limited analysis quality and potential undetected vulnerabilities, particularly in dynamically typed programming languages like PHP, due to incomplete class definitions and multiple entry points causing ambiguity in global variables with the same name but different types.

Innovation Solution

A two-pass fixed-point type inference algorithm is implemented, where the first pass builds inferred definitions of unknown types and propagates type information along control flow paths, followed by a second pass using a standard type inferencing algorithm after renaming global variables with the same name but different types, thus enhancing the robustness of static analysis.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Extent of automation

If static analysis is performed on incomplete application program code with missing user-defined type definitions, then analysis can be automated without executing the code, but the analysis quality is limited and security vulnerabilities may go undetected

Engineering Contradiction:
Improveautomation of code analysisVSAvoidanalysis quality
Core Design Contradiction:
Extent of automationVSMeasurement precision

Solution Approach 1:

The system performs preliminary type inference before static analysis by extracting type definitions from code comments and documentation, and by analyzing control flow and data flow to infer variable types. This preliminary action provides the type information needed for high-quality static analysis without requiring complete source code or code execution.

Inventive Principle:
Principle #10Preliminary action

2Ease of operation

If type inference is performed to detect variable types in dynamically typed languages, then explicit type declarations are not required, but the context analysis increases system complexity

Engineering Contradiction:
Improvecoding simplicityVSAvoidanalysis system complexity
Core Design Contradiction:
Ease of operationVSDevice complexity

Solution Approach 1:

The type inference system is segmented into multiple independent modules: control flow analysis module, data flow analysis module, type constraint extraction module, and type solver module. Each module handles a specific aspect of type inference, making the overall complex system manageable and maintainable while providing accurate type detection for dynamically typed languages.

Inventive Principle:
Principle #1Segmentation

3Adaptability or versatility

If global variables with the same name but different types are present due to multiple entry points, then the application can handle different execution paths, but type ambiguity arises and limits static analysis quality

Engineering Contradiction:
Improvehandling multiple entry pointsVSAvoidtype determination accuracy
Core Design Contradiction:
Adaptability or versatilityVSMeasurement precision

Solution Approach 1:

The system applies local quality by determining types based on local context rather than assuming a single global type. When the same variable name appears in different entry points or control flow paths, the system infers different types for each local context using control flow analysis and type constraints specific to that location, thereby resolving type ambiguity while maintaining support for multiple entry points.

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS20260111198A1Inferring type definitions of user-defined types of variables in application program code
Publication Date: 2026.04.23 VERACODE INC
  • US20260111198A1 patent drawing
  • US20260111198A1 patent drawing
  • US20260111198A1 patent drawing

AI summary

Type definitions of user-defined types in application program code for which definitions are absent (“unknown types”) are inferred. A static analyzer implements two passes of a fixed-point type inference algorithm. Each pass encompasses a plurality of traversals of the application's control flow to build inferred definitions of unknown types until the inferred definitions are maximally built. To build an inferred definition, based on inferring a variable is an unknown type, the static analyzer infers member variables/functions of the unknown type based on contextual information associated with the variable. Type information of unknown types is propagated along control flow paths. After the first pass terminates, unknown types can be assigned known types based on matching of inferred definitions. Inferred definitions of remaining unknown types are incorporated into the application program code. A second pass of type inferencing and data flow analysis are then performed with the inferred definitions incorporated therein.