I created a variable-length structure. However, when I want to apply it to data with empty array, it treats the immediately following data as array elements of the data structure.
AFAIK this is expected behavior per IDA’s variable-length structure design—IDA cannot infer VLA size, so you must always explicitly specify it.
From the VLA tutorial: “since the structure size cannot be calculated by IDA we need to specify the desired structure size by selecting an area to convert to a structure. Another way to specify the size would be to use the * hotkey. In all cases, you need to tell IDA the exact size.”
Workaround (manual):
Position cursor at 0x00811A12
Select exactly 4 bytes (drag to 0x00811A15, or press * and enter 4)
Select exactly 4 bytes (drag to 0x00811A15, or press * and enter 4)
Alt+Q → apply struct_1
I tried it, but it didn’t work.
I noticed the source text in the tutorial contained structures with empty arrays. However, the tutorial didn’t show how it looks like when expanded or collapsed. So I’m not sure if this is supposed to happen.
In fact, this is not the full truth. If the last field is a 0-sized string literal (e.g.A→ 0 elements), then IDA will try to determine the end of the string when applying the struct.