IP Library Granted Patent US 11,599,345
Granted Patent B2
US 11,599,345 · App. 17/518,971 · Granted Mar 7, 2023

Language interoperability to automate code analysis

Inventors: Shao Kun Deng (Bellevue, WA); Matthew Glenn Jin (Seattle, WA); Shuvendu Lahiri (Sammamish, WA); Xiaoyu Liu (Bothell, WA); Xin Shi (Seattle, WA); Neelakantan Sundaresan (Bellevue, WA)
Assignee: MICROSOFT TECHNOLOGY LICENSING, LLC.
G06F8/447G06F8/433G06F8/437G06F8/53G06F11/3604G06F16/219G06F16/2379
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,599,345
App. No.
17/518,971
Granted
Mar 7, 2023
Kind
B2
Abstract

Language interoperability between source code programs not compatible with an interprocedural static code analyzer is achieved through language-independent representations of the programs. The source code programs are transformed into respective intermediate language instructions from which a language-independent control flow graph and a language-independent type environment is created. A program compatible with the interprocedural static code analyzer is generated from the language-independent control flow graph and the language-independent type environment in order to utilize the interprocedural static code analyzer to detect memory safety faults.

Claims (58)

1. A system comprising:

one or more processors coupled to a memory; and

one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions that perform actions to:

monitor a source code repository for an event associated with a first program that necessitates code review; and

upon occurrence of the event:

generate a language-independent control flow graph of the first program and a language-independent type environment of the first program;

convert the language-independent control flow graph of the first program into a second program, wherein the second program includes analysis language instructions of an interprocedural static code analyzer; and

invoke the interprocedural static code analyzer on the second program to detect a memory safety fault or bug in the first program.

2. The system of claim 1 , wherein the one or more programs include further instructions that perform actions to:

extract binary files of the first program;

decompile the binary files of the first program into intermediate language code; and

extract a procedural code flow for the first program and a type environment for the first program from the intermediate language code of each of the binary files of the first program, wherein the procedural code flow for the first program includes the analysis language instructions of the interprocedural static code analyzer.

3. The system of claim 2 , wherein the one or more programs include further instructions that perform actions to:

create the procedural code flow for the first program using a control flow graph schema; and

extract the type environment for the first program using a type schema.

4. The system of claim 2 , wherein the one or more programs include further instructions that perform actions to:

generate language-independent code for the first program from the procedural code flow for the first program and the type environment for the first program.

5. The system of claim 4 , wherein the one or more programs include further instructions that perform actions to:

decode the language-independent code for the first program into the second program having the analysis language instructions of the interprocedural static code analyzer; and

decode the type environment for the first program into types of the analysis language instructions of the interprocedural static code analyzer.

6. The system of claim 4 , wherein the language-independent code for the first program is based on a JavaScript Notation (JSON) format.

7. The system of claim 2 , wherein the intermediate language code is based on a Common Intermediate Language (CIL).

8. A computer-implemented method comprising:

extracting binary files of a first program from a version-controlled source code repository;

converting the binary files of the first program into intermediate language instructions;

analyzing the intermediate language instructions to generate a language-independent control flow graph of the first program and a language-independent type environment of the first program;

transforming the language-independent control flow graph of the first program into a second program, wherein the second program includes instructions of an analysis language of an interprocedural static code analyzer; and

applying the interprocedural static code analyzer to the second program to identify a memory safety fault or bug in the first program.

9. The computer-implemented method of claim 8 , wherein extracting binary files of a first program from a version-controlled source code repository, further comprises:

detecting, at the version-controlled source code repository, an event triggering code analysis of the first program; and

upon detection of the event triggering code analysis of the first program, obtaining the binary files of the first program from the version-controlled source code repository.

10. The computer-implemented method of claim 9 , wherein the event triggering code analysis of the first program includes a commit of the first program to the version-controlled source code repository.

11. The computer-implemented method of claim 8 , further comprising:

mapping results from application of the interprocedural static code analyzer to source code of the first program.

12. The computer-implemented method of claim 8 , wherein the first program is written in a programming language supported by the .NET framework and the interprocedural static code analyzer is written in a programming language not supported by the .NET framework.

13. The computer-implemented method of claim 8 , wherein the intermediate language instructions are Common Intermediate Language (CIL) instructions.

14. The computer-implemented method of claim 8 , wherein the language-independent control flow graph of the first program and the language-independent type environment of the first program are based on a JavaScript Object Notation (JSON) format.

15. A computer-implemented method comprising:

detecting an event triggering a code review of a first program in a version-controlled source code repository; and

performing the code review of the first program by:

converting the first program into language-independent code;

decoding the language-independent code into a second program having instructions of an interprocedural static code analyzer;

invoking the interprocedural static code analyzer on the second program to detect source code bugs in the second program;

mapping the detected source code bugs back to the first program; and

outputting the detected source code bugs in the first program.

16. The computer-implemented method of claim 15 , wherein converting the first program into the language-independent code, further comprises:

converting the first program into intermediate language code;

extracting a control flow graph of the first program and a type environment of the first program from the intermediate language code;

generating a language-independent control flow graph from the extracted control flow graph of the first program; and

generating a language-independent type environment from the extracted type environment of the first program.

17. The computer-implemented method of claim 16 , further comprising:

prior to converting the first program into the intermediate language code, obtaining binary files of the first program.

18. The computer-implemented method of claim 16 , further comprising:

serializing data of the language-independent control flow graph and data of the language-independent type environment into byte strings; and

deserializing the byte strings of the language-independent control flow graph into the second program having ordered sequences of intermediate analysis instructions.

19. The computer-implemented method of claim 18 , further comprising:

deserializing the byte strings of the language-independent type environment into a data structure for use by the interprocedural static code analyzer.

20. The computer-implemented method of claim 15 , wherein the first program is written in a programming language supported by the .NET framework and the interprocedural static code analyzer is written in a programming language not supported by the .NET framework.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 4, 2021
From: DENG, SHAO KUN; JIN, MATTHEW GLENN; LAHIRI, SHUVENDU K; LIU, XIAOYU; SHI, XIN; SUNDARESAN, NEELAKANTAN
To: MICROSOFT TECHNOLOGY LICENSING, LLC.
Reel/Frame 058022/0100 →
Continuity (2)
Continuation 15931234 · May 13, 2020
Related Publication 20220058007A1 · Feb 24, 2022