Vector35 / Vector35/binaryninja-api

Binary Ninja UI doesn't process odd sized integers and pointers

Open
#6,303 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Version and Platform (required):

  • Binary Ninja Version: 4.3.6635-dev (6a04b0e5)
  • OS: macOS
  • OS Version: 15.1.1
  • CPU Architecture: M1

Bug Description:
If an integer or pointer type is defined as a non-standard size (1, 2, 4 or 8 bytes in size) then it won't be handled properly in the Binary Ninja UI. The value of the type will just display the hex data for the bytes it covers and for pointers there will be no data reference.

Steps To Reproduce:
Set random data in a binary to one of the following types:

void* __ptr_width(0x3)
uint40_t

Or any other non-standard sizes.

Expected Behavior:
These values should be handled like any other sized integer or pointer. Which means that the type's value should not just display the bytes it covers but instead either shows a hex value (or whatever is appropriate) for an integer type or the destination for a pointer type, with a data reference, like they do in the standard size cases.

Screenshots/Video Recording:
image

Additional Information:
When setting non-standard size integer types the following message is logged in the Binary Ninja UI:

[Default] Type size mismatch converting uint40_tuint40_t to Clang (Binja size 0x5, Clang 0x8)

Also it seems that due to this Clang, Binary Ninja, mismatch, defining a structure with a uint24_t followed by a uint8_t using the C source parser will create a type that is larger than 4 bytes. Using the API the structure will be the expect 4 bytes with the uint8_t field at an offset of 3. Thats another bug so that might require another bug report but it might be related.

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

Reproduce the issue in the Binary Ninja UI with __ptr_width(0x3), uint40_t, and the uint24_t/uint8_t structure cases described above. Start by tracing how non-standard integer and pointer sizes are displayed and converted to Clang, then compare those paths with standard sizes. Done means odd-sized integers display their values, pointers produce destinations and data references, and the reported structure layout mismatch is understood or separated.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.