Vector35 / Vector35/binaryninja-api
`bv.get_code_refs_for_type_field` does not retrieve refs for a type field if the variable type is a `typedef someStruct* variableType`
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
Bug Description:
bv.get_code_refs_for_type_field does not retrieve refs for a type field if the variable type is a typedef someStruct* variableType
This also impacts xrefs in UI. This appears to be unintentional as changing the type to the base struct and back to the Typedef computes the type references.
This impacts type references for all Objective-C Ivars.
Steps To Reproduce:
Please provide all steps required to reproduce the behavior:
- Open a Binary using Objective-C w/ the objective-C workflow enabled
- Select a class, double click the type of the first argument and navigate to it in the types view
- Pick an ivar to target
list(bv.get_code_refs_for_type_field('class_<CLASSNAMEHERE>', [i for i in bv.get_type_by_name('class_<CLASSNAMEHERE>').members if i.name == '<IVARNAMEHERE>'][0].offset))- The list will be empty. Change the type for the first argument in the function to
struct class_<CLASSNAMEHERE>* - Run the command again, type refs will be computed for that structure.
- Change the type for
selfback to<CLASSNAMEHERE>. - Run the command again. The type ref is still there.
Expected Behavior:
Code references for type fields should propagate through Typedefs
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 bv.get_code_refs_for_type_field entry point and reproduce the Objective-C ivar case using the listed Binary Ninja workflow and commands. Trace how typedef pointer types are handled and verify that type references propagate through the typedef and appear in UI cross-references without first changing the type to its base struct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, objective-c, python
- Domain
- reverse-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100