Struct Overlapping Single Variables on Stack

Aperta
#5,285 0 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
cpp

Direzione di ricerca

Start with discussion #5260 and the linked private issue, since no source file, test, or entry point is named here. The desired result is to retain earlier overlapping stack variables while showing the later struct and its members at the same addresses.

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

Descrizione

Component: Core

If I understand the following correctly, I do not believe we currently support this use-case. But, I can understand how/why it would be useful. So, we should consider adding support for this.

EDIT: Vector 35 employees, please see the private issue that has been linked into this one below that discusses some implementation details.

Discussed in https://github.com/Vector35/binaryninja-api/discussions/5260

Originally posted by utkonos April 10, 2024
When a particular address on the stack is used for different variables, they're all created automatically and nicely (this is just an examples of overlap at an address; these particular variables are totally not related to the problem below):
image

However, if I want to set the type to a struct that overlaps the locations used previously on the stack, after setting that type, the other varables are gone. Is there a way to get this to work?

Here is how the Stack view looks before. That struct is incorrectly a pointer at the moment just as a placeholder.
image

The two variables enc_str.size and fill_value are both input parameters for init_string here:
image

That function cleans up the stack via ret 8.

Later in the function, space is created for the struct on the stack via sub esp, 0x18. For some reason, if I set the type at that location to the struct, it blows away those two previous stack variables.
image

I want to keep those two variables in the second screenshot above and set a struct at the same addresses in the stack. This way it reflects both usages at the different points in the function.

Is what I want to do possible? I can always just write comments to work around this, but the downstream uses of that struct don't show up nicely with the members in the disassembly view.

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.