Struct Overlapping Single Variables on Stack

Abierto
#5,285 0 comentarios 2 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
cpp

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C++
Estrellas
1.3k
Forks
298
Merge medio
5 d 5 h
PR fusionados (30 d)
19

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Vector35/binaryninja-api

Todos los issues de Vector35/binaryninja-api

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.