kaitai_struct
kaitai_struct copied to clipboard
`type` field allows use the array syntax for defining type
The following .ksy
is accepted by compiler (at least in web-IDE) and parses 1 byte:
meta:
id: type_reference_bugs
types:
u2be:
seq:
- id: value
size: 1
seq:
- id: value
type: u2be[]
I think, that such constructions should be prohibited. The seq.type
field should not allow using the "array" syntax for defining a type reference. This not only have unclear semantics, but also threated as a reference to a user type u2be
.
Another problem that may be misleading is the ability to have a custom type named as one of the built-in. I think we should prohibit this too. In the example above, if you delete the []
part from the type, built-in type will be used.