Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
927 stars 209 forks source link

Changing the type of a member in a structure at the start of an array in linear view changes the type of the array, not the member #4831

Open op2786 opened 11 months ago

op2786 commented 11 months ago

Version and Platform (required):

Bug Description: In the screenshot below I want to set MajorFunction to one of IRP_MJ enumeration in linear view but without changing the type of MajorFunction to enum IRP_MJ.

Here is how it is look like before I try to set MajorFunction to enumeration:

This is what I got when I click on 0x0 in line uint8_t MajorFunction = 0x0, press M and select IRP_MJ_CREATE.

I noticed that when I click on 0x1 in line uint8_t MajorFunction = 0x1 and press M select enum dialog does not open up. Probably this is why it corrupts the stucture. What happening there is probably when I do this in uint8_t MajorFunction = 0x0, actually it is the start offset of the structure. So even if I believe I'm doing enum select operation in line uint8_t MajorFunction = 0x0, it is actually doing that for the start offset of the structure, and creates a enumeration variable there.

Expected Behavior: I expect BN to allow me select enumeration in structure members in linear view

xusheng6 commented 10 months ago

You guess is probably right. The good news is that we have more information than the address to disambiguate it, thus it can be fixed without requiring a major change.

I also changed the title to be more informative.