Vector35 / Vector35/binaryninja-api

Simplify `sbb` ternary pattern

Aperta
#5,688 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Component: Core Core: HLIL Effort: Low IL Optimization Impact: Medium
Lingua principale
C++
Stelle
1.3k
Fork
298
Merge medio
5g 5h
PR unite (30g)
19

Descrizione

The following pattern:

a = sbb(x, x, y != 0) & -4

Can be simplified down to:

if (y != 0)
  a = -4
else
  a = 0

Example: sparkle giraffe juggling toaster.zip @ 1c00013a0

Seen @ 1c00013a0 as

a = (sbb(x, x, y != 0) & -4) + 5

notice the additional + 5 at the end. Most likely we'd need to take that into account too and do the whole simplification in one step. So the output becomes

if (y != 0)
  a = 1
else
  a = 5

Compare with other tools here: https://dogbolt.org/?id=eed48ff1-8c4b-4a5d-8fc8-abc82a21b1fe#BinaryNinja=215&Hex-Rays=523

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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.

Direzione di ricerca

Reproduce the pattern from commit 1c00013a0, including the added +5 case, and inspect how the decompiler currently handles sbb(x, x, y != 0) & -4. Compare the result with Binary Ninja and Hex-Rays using the linked Dogbolt example. Done means the output becomes a conditional with 1 and 5 for the full expression, rather than simplifying only the masked subexpression.

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

Valutazione

Stack tecnologico
cpp
Ambito
reverse-engineering
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.