fox-it / dissect.cstruct_legacy

A no-nonsense c-like structure parsing library for Python
MIT License
239 stars 25 forks source link

VSA not working as expected. #10

Open Hadatko opened 4 years ago

Hadatko commented 4 years ago

Demo:

struct A
{
    uint8 a;
    uint8 b[];
};

The expected behavior of: cparser.A(b'\x01\x02\x03\x04\x00\x00') should be

struct A:
- a: 0x1
- b: [2, 3, 4, 0, 0]

current

struct A:
- a: 0x1
- b: [2, 3, 4]

It should take rest of binary data which are at the end of blob (here 5bytes) and count how much numbers he can take (5/1{uint8}) and than convert data at the end.

Hadatko commented 4 years ago

I have patch for this. I will post it tomorrow. But i found out that it is not working for dynamic array of structures. Will figure out tomorrow.

Hadatko commented 4 years ago

This patch is fixing VSA for both array of numbers and structures...