HLIL incorrectly resolving union fields in some cases

Aperta
#7,407 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Load the attached bin.zip in Binary Ninja, go to 0x077d050, and apply the provided union type to the second argument. Compare the HLIL output with MLIL for the union fields token->_long.size.b and token->_long.data. Done means HLIL resolves these fields correctly instead of emitting token->_long.b and __offset(0x10).q.

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

Descrizione

Component: Core Effort: Medium Impact: Medium

Version and Platform (required):

  • Binary Ninja Version: 5.2.8284-dev Personal (47c97600)
  • Edition: Non-Commercial
  • OS: MacOS
  • OS Version: 15.5
  • CPU Architecture: M1

Bug Description:
HLIL can't resolve union fields properly. Here is an example with 2 things:
1 - you can see that in if condition HLIL failed to resolve token->_long.size.b and generated token->_long.b instead;

2 - in true-branch instead of token->_long.data for some reason there is token->_long.__offset(0x10).q.

In MLIL however fields resolved correctly, buggy behaviour only in HLIL.

In attached screenshots you can see how it looks like in HLIL (first screenshot) and MLIL (second screenshot):

Image Image

And here is how it looks in HLIL, if i change the type of token from union to regular structure (string::_long), fields resolved correctly:
Image

The type for the repro:

struct string::_long
{
    uint64_t size;
    uint64_t cap;
    char* data;
};

union string
{
    struct string::_long _long;
};

Steps To Reproduce:
Please provide all steps required to reproduce the behavior:

  1. Go to 0x077d050
  2. Apply provided union type to the second argument

Expected Behavior:
HLIL should resolve union fields correctly.

Binary:
https://github.com/user-attachments/files/22319368/bin.zip

Lingua principale
C++
Stelle
1.3k
Fork
298
Merge medio
5g 5h
PR unite (30g)
19

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.

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.