Vector35 / Vector35/binaryninja-api

Display As does not uniquely identify tokens in IL

Open
#3,490 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core Component: UI Impact: Low
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

The implementation of "Display As" is differentiating tokens based on their values. This is problematic -- for example, if we have two different tokens that happen to have the same value at the same address, then setting the display type of one of them will also set the display type of the other one.

For the following code

  30 @ 100003ec0  if (temp4 u> 0x22) then 34 @ 0x100003ed8 else 49 @ 0x100003ec4

After I set the display type of either the 0x22 or 34 token (0x22 == 34), I get this

100003ec0  if (temp4 u> 4.76441478e-44) then 4.76441478e-44 @ 0x100003ed8 else 49 @ 0x100003ec4

The display as use the tuple of (value, operand_index) to identify tokens. I am not sure whether the operand_index is supposed to be different for the two tokens, but involving the value of the token is definitely not a good idea and a source of obscure bugs

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 tracing the Display As implementation and how it identifies tokens, paying particular attention to the (value, operand_index) tuple. Reproduce the example with two equal-valued tokens at the same address, then verify that changing one token's display type no longer changes the other.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.