Constants should not be displayed as string literals when used in contexts where string literals don't make sense (bitwise operations, comparisons against integer variables)

Offen
#6,883 1 Kommentar 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet

Rechercherichtung

Use the provided binary and inspect address 0x283334 across LLIL, MLIL, HLIL, and pseudo C, focusing on how the 0xffff constant is rendered in the bitwise operation. The issue is done when constants used in bitwise operations or comparisons against integer variables are not displayed as string literals, while genuine string contexts remain unaffected.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Component: UI Effort: Medium Impact: Low

Version and Platform (required):

  • Binary Ninja Version: 5.1.7500-dev (1da2316a)
  • OS: macOS 15.5
  • CPU Architecture: arm64

Bug Description:
In some armv7 code I've been looking at it's pretty common to see 16-bit loop indexes updated using:

00283334    10  014084e2   add     r4, r4, #0x1
…
00283344    10  7440ffe6   uxth    r4, r4, ror  #0

This is basically i = (i + 1) & 0xffff.

If you're unlucky enough for 0xffff to be an address within a character array, Binary Ninja renders the 0xffff as a string literal in MLIL, HLIL, and pseudo C despite it not making any sense given the context. In LLIL it is rendered as data_0xffff which is not great, but at least lets me see the constant value.

This is not specific to 0xffff, that just happens to be a common pattern in the binary I've been looking at.

Steps To Reproduce:

  1. Open the provided binary.
  2. Go to 0x283334.

Expected Behavior:
No string literal.

Screenshots/Video Recording:

In this case 0xffff points within the dynamic symbol table and is one byte into the literal fseek.

Image

Binary:
eager dragon paints eagerly

Vorherrschende Sprache
C++
Sterne
1.3k
Forks
298
Ø Merge
5 T. 5 Std.
Gemergte PRs (30 T.)
19

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Vector35/binaryninja-api

Alle Issues in Vector35/binaryninja-api

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.