Skip to content

Fix OperandReferenceAnalyzer to recognize all undefined data types - #9401

Merged
ryanmkurtz merged 2 commits into
NationalSecurityAgency:masterfrom
0xFE4415:undef_data
Jul 24, 2026
Merged

Fix OperandReferenceAnalyzer to recognize all undefined data types#9401
ryanmkurtz merged 2 commits into
NationalSecurityAgency:masterfrom
0xFE4415:undef_data

Conversation

@0xFE4415

Copy link
Copy Markdown
Contributor

Use Undefined.isUndefined(dt) instead of dt instanceof Undefined, so that multi-byte undefined types are detected as undefined.
The instanceof check missed some variants of undefined causing the analyzer to treat them as defined and skip creating pointer references on them.

@0xFE4415

Copy link
Copy Markdown
Contributor Author

Minimized reproduction:

gcc 1.c -o a.out
source build/venv/bin/activate # I used: ./gradlew prepPyGhidra
python run_1c.py a.out

Expected Result (Slot 1 is a pointer):

'c' at 00403020, pointer size = 8
  slot 0 00403020: dt=undefined len=1 pointer=False
  slot 1 00403028: dt=pointer len=8 pointer=True
...

Actual Result (Slot 1 is undefined):

'c' at 00403020, pointer size = 8
  slot 0 00403020: dt=undefined1[16] len=16 pointer=False
  slot 1 00403028: dt=undefined1[16] len=16 pointer=False
...

Here is the compiled binary: (a.out.zip).

@0xFE4415

Copy link
Copy Markdown
Contributor Author

Disclosure: I added tests with help of an AI assistant. I also manually verified that UndefinedArray test is, in fact, a regression test.

@emteere emteere added Status: Internal This is being tracked internally by the Ghidra team and removed Status: Triage Information is being gathered labels Jul 22, 2026
@emteere

emteere commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Looks good. Thanks for the PR

@ryanmkurtz ryanmkurtz added this to the 12.2 milestone Jul 23, 2026
@ryanmkurtz
ryanmkurtz merged commit 67e67d0 into NationalSecurityAgency:master Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature: Analysis Status: Internal This is being tracked internally by the Ghidra team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants