Vector35 / Vector35/binaryninja-api
Auto structure member creation generates strange structure member for enumeration
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.6.4783-dev, 6fc13294
- OS: macos
- OS Version: 14.2
- CPU Architecture: arm64
Bug Description:
When FnGetSystemDEPPolicy is defined like this: typedef DEP_SYSTEM_POLICY_TYPE (* FnGetSystemDEPPolicy)(); and given the example code below:
163d572e dbg->__offset(0x2b0).d = 0
163d5734 __builtin_memset(&dbg->__offset(0x2b8).q, 0, 0x21)
163d575e HMODULE hModule = GetModuleHandleA("kernel32.dll")
163d576e
...
163d5787 FnGetSystemDEPPolicy GetSystemDEPPolicy = GetSystemDEPPolicy
163d5791
163d5791 if (GetSystemDEPPolicy == 0) {
163d579d GetSystemDEPPolicy = GetProcAddress(hModule, "GetSystemDEPPolicy")
163d57a3 GetSystemDEPPolicy = GetSystemDEPPolicy
163d57a3 }
163d57b1
163d57b1 dbg->__offset(0x2b0).d = GetSystemDEPPolicy()
When I press S on line 163d572e BN creates a member at 0x2b0 for dbg structure like this:
enum : uint32_t
{
DEPPolicyAlwaysOff = 0x0,
DEPPolicyAlwaysOn = 0x1,
DEPPolicyOptIn = 0x2,
DEPPolicyOptOut = 0x3,
DEPTotalPolicyCount = 0x4
} field_2b0;
Which is looks like not appropriate. I expect BN to create a structure member there which have a DEP_SYSTEM_POLICY_TYPE type. When member created like that (enum _DEP_SYSTEM_POLICY_TYPE field_2b0) even if I'm able to change the type from linear view with Y, I'm not able to change it from types sidebar.
Steps To Reproduce:
I don't know how to reproduce this in another binary.
Expected Behavior:
I expect BN to create a member there with type DEP_SYSTEM_POLICY_TYPE.
Screenshots:
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 with the auto structure member creation triggered by S at 0x2b0 in the provided example, comparing the generated enum member with the expected DEP_SYSTEM_POLICY_TYPE. Investigate why the member cannot be changed from the Types sidebar; done when a reproducible case creates the member with the expected type and supports the intended type editing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools, reverse-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100