Vector35 / binaryninja-api

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

Inherited member access shows up as "__offset(0x0)" #4616

Closed wildex999 closed 8 months ago

wildex999 commented 1 year ago

Version and Platform (required):

Bug Description: While working on an AArch64 project, I found that the variables would start to show _offset(...) at random places for some struct member accesses. Some places it would also show a write to two int32_t members as a single int64_t write instead. I was able to determine that this only happened with members tagged as __inherited, and removing that tag would make it show up as expected in the High Level IL/Pseudo C View of the function. The first problem seems to be fixed in 3.5.4514, but the second one remains.

I have managed to re-produce this problem with a minimal C++ x64 project, and have attached the compressed bndb.

Steps To Reproduce:

  1. Open the attached bndb
  2. Go to the main function and observe the construction of the "Heap" class.
  3. Note how the value writes to rax_2->childList's count and offset are combined, and also show the __offset(Address 0x14000122f)
  4. Remove the __inherited tags from the Heap and OffsetList structs and observe everything now looks as expected.

Expected Behavior:

It's expected that the behavior with inherited members should be the same with non-inherited members. In this case it's expected to individually show the value being assigned to ChildList.ListImpl::count = 0, and childList.offset = 0xffffffff.

Screenshots: Problem with __inheritedin structs: Screenshot_1

After removing __inheritedtag: Screenshot_2

Additional Information:

BNDB: BinaryNinja_Inherited_Bug.zip

D0ntPanic commented 8 months ago

Fixed in 3.6.4747