Skip to content

[Bug][ghidra2cpg] Ghidra frontend does not support indirect jumps #5809

@Ik0ri4n

Description

@Ik0ri4n

Describe the bug
The Ghidra frontend does not resolve indirect jumps or use Ghidra's analysis for that. Instead, the resulting control flow will simply miss the corresponding edges. The resulting CFG will contain disconnected branches.

This is especially relevant since indirect jumps are frequently used to implement switch-case-expressions. Any flow analysis on such a program will be incomplete.

To Reproduce
Steps to reproduce the behavior:

  1. (Optional) Recompile with your compiler of choice
    • You need to verify that the program actually uses a jump table!
    • You may need to modify the program to force that!
  2. Import the binary: importCode("../indirect-jump/test", "broken-jumps", language="GHIDRA")
  3. Inspect the generated CFG: cpg.method("main").plotDotCfg

Expected behavior
The CFG contains edges for each case branch, if it can be recovered by Ghidra.

Screenshots

CFG with missing edges

Desktop

  • OS Ubuntu 25.04
  • Joern Version 4.0.468
  • Java Version 21.0.9
  • GCC Version gcc (Ubuntu 14.2.0-19ubuntu2) 14.2.0 (used to compile the provided binary)

Attachments
test.zip
test.c

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions