Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

HLIL drops zx when folding byte-width arithmetic, producing an incorrect expression

Aperta
#8,513 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp

Direzione di ricerca

Open or recompile x86_zx_drop.c and inspect the target_* functions in both MLIL and HLIL, focusing on the zero- and sign-extension steps described in the report. Compare the generated HLIL with the expected target_zx expression and verify that zx and sx remain effective after folding, including the supplied argument values.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Version and Platform (required):

  • Binary Ninja Version: Version 5.0.7648
  • Edition: Non-Commercial
  • OS: Ubuntu
  • OS Version: 24.04
  • CPU Architecture: x64

Bug Description:
HLIL discards zero- and sign-extensions when folding expressions, producing arithmetic that is numerically incorrect.

MLIL correctly models a narrowing step as its own statement, which justifies reducing a constant modulo the narrower width. HLIL folds the chain into a single expression and drops the extension, but keeps the reduced constant — so the reduction is no longer valid.

Expected Behavior:
target_zx should be

uint64_t target_zx(int32_t arg1, int32_t arg2) {
  return (uint8_t)(arg1 - 0x2402) + arg2 - 0x2402;
}

Example where the behaviour is wrong:
If arg1=0x2405 and arg2=0x2405, arg1 - 2 + arg2 - 0x2402 = 0x2406 whereas the expected returned value is 0x6.

How to reproduce:
Open x86_zx_drop or recompile x86_zx_drop.c and look at the functions target_*.

Screenshots/Video Recording:
Image

Binary:
x86_zx_drop.zip

Additional Information:
Reproduces with zx and sx, and whether the extension comes from a byte-width instruction (movzx/movsx, MSP430 .b forms) or from a mask that MLIL canonicalises into an extension (and #0xff). Multiple extensions in one folded chain are all dropped.

Also reproduces on the current Binary Ninja build via Decompiler Explorer (dogbolt.org), so this is not specific to 5.0.7648.

Possibly related to #6371 (also HLIL and extension handling), though the symptom differs.

Lingua principale
C++
Stelle
1.3k
Fork
297
Merge medio
2g 22h
PR unite (30g)
14

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Vector35/binaryninja-api

Tutte le issue di Vector35/binaryninja-api

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.