rizinorg / cutter

Free and Open Source Reverse Engineering Platform powered by rizin
https://cutter.re
GNU General Public License v3.0
15.32k stars 1.14k forks source link

Editing Global Variable Displays Incorrect Variable in Dialog #3340

Closed Zack08110 closed 1 month ago

Zack08110 commented 1 month ago

Environment information

Describe the bug

When trying to edit the Global variable the Dialog shows a variable different from the variable which was clicked upon.

To Reproduce

Steps to reproduce the behavior:

  1. Go to the Globals tab for the binary
  2. Right-click on any of the shown Global Variables
  3. Click on Edit Global Variable
  4. See the difference between the address of the Global Variable and the Variable Shown

Expected Behaviour

The Dialog should show the variable which was clicked upon

Screenshots

image

Additional context

I am new to this codebase and would like to explore and research this issue if it is an issue and resolve it.

Zack08110 commented 1 month ago

The globals variable of type QList<GlobalDescription> GlobalsWidget::globals is storing the data in a different order than what is shown in the globals tab

Zack08110 commented 1 month ago

The current solution coming to my mind is to sort the Globals QList based on the type of sorting is selected by the user every time

karliss commented 1 month ago

The current solution coming to my mind is to sort the Globals QList based on the type of sorting is selected by the user every time

Nothing of the sort should be necessary. All the the other similar widgets are working fine without doing something like that.

Most likely there is mixup of index for globalsModel (responsible for querying and storing retreived data from rizin) and globalsProxyModel (the one responsible for filtering and sorting). The fix should be to query data from proxyModel, since that's what the tableview is interacting with and thus that's what the current selection index is for.