Vector35 / Vector35/binaryninja-api

Renaming struct field behaves unexpectedly when fields share names

Open
#4,536 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: UI Impact: Medium UI: Dialogs UI: Linear
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.4412-dev
  • OS: Windows
  • OS Version: 11
  • CPU Architecture: x64

Bug Description:
When a struct has two or more fields that share the same name, and multiple of them appear inside of the same function, and the user attempts to rename (via n shortcut) one of those fields that is not the first to appear in the struct, the wrong field will be renamed.

Steps To Reproduce:
Please provide all steps required to reproduce the behavior:

  1. Open a binary and define a struct with multiple fields that share the same name
  2. Navigate to a function where multiple fields of this struct will be referenced
  3. Select (by single-click highlighting) one of the field names, attempting to select a field that has a greater offset into the struct than at least one other
  4. Trigger the field rename modal via the n shortcut
  5. Rename the field and observe that the first field to share the original name was updated, and not the one that was selected
  6. Undo, and then select by double-clicking the field name, observing that attempts to rename the field work as expected

Expected Behavior:
The field that was selected is renamed, not another field

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in Binary Ninja using a struct with duplicate field names and a function that references multiple fields, following the listed single-click and double-click cases. Trace the field selected by the rename shortcut and verify that renaming changes the selected field rather than the first field with the same name; confirm both selection methods and undo behavior.

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
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.