Vector35 / Vector35/binaryninja-api

BN should be smart enough to reference the inherited class when necessary

Open
#4,964 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core Core: MLIL Effort: Medium Impact: Medium
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.6.4790-dev, 10b89271
  • OS: macos
  • OS Version: 14.3
  • CPU Architecture: arm64

Bug Description:
I'm uncertain whether this is a bug or a missing feature. In the current implementation, if a reference is made to the base class of the derived class, BN displays it as shown in the example below:

Actually, the reference here is not to the VFT, but to the class itself, even if technically they are the same. It would be preferable if BN were intelligent enough to reference it as something like this->Pet.

Cat class is defined as follows:

class __base(Animal, 0) __base(Pet, 0x18) Cat

Hence, BN has information indicating that when offset 0x18 is directly referenced, it could actually be referencing the Pet class depending on the context. For instance, if this reference occurs for a function parameter and the target parameter type is Pet* (as shown in the screenshot), BN could display it as this->Pet.

Of course, there will be situations (as can also be seen in the screenshot) where references are made to the Pet class's VFT. However, I believe it is predictable whether the reference is made to the class or the VFT.

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 example on Binary Ninja 3.6.4790-dev for macOS arm64, using the shown Cat inheritance declaration and the reference whose parameter type is Pet*. Determine how the current display distinguishes a class reference from the Pet virtual-function table, then verify that class references render contextually as this->Pet without changing VFT references.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
reverse-engineering
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.