Vector35 / Vector35/binaryninja-api
Structure members not created when using shifted pointers
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
Version and Platform (required):
- Binary Ninja Version: 3.5.4480-dev, 60681746
- OS: windows
- OS Version: 11
- CPU Architecture: x86_64
Bug Description:
Normally if a structure is defined with a size, but with undefined members (like a new structure with size 0x200 but no members specified), when those members are referenced (e.g. arg1->__offset(0x20)) Binary Ninja gives the option to create members for the structure based on the references in HLIL.
However, when the type is a shifted pointer (e.g. int64_t* __offset(VstorDeviceExtension, 0x20) arg2), and then operations on an undefined member occur with the shifted pointer (e.g. (arg2 - 0x20)->__offset(0x108)), I'd expect to be able to create all members for the VstorDeviceExtensions like normal, as Binary Ninja knows that arg2 - 0x20 is referencing the start of VstorDeviceExtension and the __offset(0x108) is a member of VstorDeviceExtension at offset 0x108.
However this option to create all members for the structure is not available in the UI.
Steps To Reproduce:
- Create a structure/type with a size and no defined members
- Create an offset pointer to somewhere within the type
- Note that when that offset pointer references an undefined member of the parent type, the UI does not give the option to auto-detect and define the members
Expected Behavior:
The UI should provide the option to auto-create members at the referenced offsets for shifted pointers
Screenshots:
Additional Information:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the shifted-pointer case in the UI using the structure, offset pointer, and HLIL references described in the issue. Trace the existing auto-create-members behavior for ordinary undefined structure references and make the shifted-pointer case offer equivalent member creation at the referenced offsets; verify both cases in the UI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- reverse-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100