-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Description
Describe the bug
In a loop looking at elements of an array, Ghidra isn't realising that a local variable added to an address is actually equivalent to looking at the same field in the next(/previous) array element. (It doesn't seem to be checking the local variables increment (or decrement) against the size of the array's element!) This is producing expressions like
(*(char *)((int)&DgnPhoneme_0x4_t_ARRAY_1210_9b34[0].b2 + local_4) == '-')
instead of
(DgnPhoneme_0x4_t_ARRAY_1210_9b34[nItem].b2 == '-')
where nItem is the loop index.
With nested arrays, it gets worse!
To Reproduce
Steps to reproduce the behaviour:
- Load in the enclosed function (from the
Decompile:PanelsDebug Function Decompilationmenu) - Search down the decompiled code to find the output above
- See issue
Expected behaviour
Use of correct(/better) array syntax in decompiled C output.
Screenshots
N/A
Attachments
dragon_FUN_1160_0049.zip
Environment (please complete the following information):
- OS: Windows 11
- Java Version: 17.0,3.1
- Ghidra Version: 10.4.DEV
- Ghidra Origin: locally built from 26d4bd9
Additional context
This is an extract from a Windows NE DLL (circa 1990s)