Support for variable size structure array in decompiler
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Domaine
- compilers, reverse-engineering
Piste de recherche
Start with the supplied C reproduction and compare its current HLIL output with the expected indexed structure-array accesses. Trace the decompiler path responsible for structure-member and pointer-array indexing, then add coverage demonstrating the expected output and verify that both the allocation loop and print_persons example decompile correctly.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I've a structure which have a variable sized structure array in it. After importing and setting types it decompiled like this in HLIL:
people people
people.count = 0
people.arr = malloc(0x30)
... (memset )
for (int32_t i = 0; i s<= 3; i = i + 1)
//expected: people.arr[i].age = i
people.arr[sx.q(i) * 4] = i
//expected: people.arr[i].name = "test name"
*(people.arr + sx.q(i) * 0x10 + 8) = "test name"
people.count = people.count + 1
print_persons(people: &people)
print_persons
for (int32_t i = 0; i s< 3; i = i + 1)
printf("Person: %s, Age:%d\n", people->arr[sx.q(i)].name, zx.q(people->arr[sx.q(i)].age))
I guess this is not a bug, but a feature not implemented yet. I could not find an issue for it so creating one for tracking it.
Test code:
typedef struct _person
{
int age;
char* name;
}person;
typedef struct _people
{
int count;
person* arr;
}people;
void print_persons(people *people)
{
for (int i = 0; i < 3; i++)
{
printf("Person: %s, Age:%d\n", people->arr[i].name, people->arr[i].age);
}
}
int main()
{
people people;
people.count = 0;
people.arr = malloc(sizeof(person) * 3);
memset(people.arr, 0, sizeof(person) * 3);
for (int i = 0; i <= 3; i++)
{
people.arr[i].age = i;
people.arr[i].name = "test name";
people.count++;
}
print_persons(&people);
}
- Langage dominant
- C++
- Étoiles
- 1.3k
- Forks
- 298
- Merge moyen
- 5 j 5 h
- PR mergées (30 j)
- 19
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de Vector35/binaryninja-api
-
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
Vector35/binaryninja-api#8540 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Vector35/binaryninja-api#8516 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
Vector35/binaryninja-api#8503 ·
-
normalize time logs from WARP Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
Vector35/binaryninja-api#8446 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
Vector35/binaryninja-api#8444 ·
Toutes les issues de Vector35/binaryninja-api
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
gazebosim/gz-sensors#662 · 1 commentaire ·
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
-
comp-datalake
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
ClickHouse/ClickHouse#121222 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
LadybirdBrowser/ladybird#12123 ·