wader / fq

jq for binary formats - tool, language and decoders for working with binary and text formats
Other
9.54k stars 218 forks source link

fit: Fixed subfield referencing fields below self in message #877

Closed mlofjard closed 4 months ago

mlofjard commented 4 months ago

Some subfields are referencing fields that come after themselves in the message. This is allowed by spec, but means that data messages have to be pre-read to include all potential reference fields. I did this with d.PeekUintBits, but had to wrap in since that method ignores d.Endian.

Maybe my peekUintBitsEndian should be moved to the decode package?

wader commented 4 months ago

👍 Will merge once CI is happy

I wonder if one could have a type to bit size table somehow and simplify it even more?

When reviewing the code i was thinking if there are some things that are now looked up by string could use int constant somehow?

mlofjard commented 4 months ago

👍 Will merge once CI is happy

I wonder if one could have a type to bit size table somehow and simplify it even more?

When reviewing the code i was thinking if there are some things that are now looked up by string could use int constant somehow?

Generally fDef.size should dictate how many bytes to read for each field, since there are many fields (those labeled UNKNOWN_X) that are not in the official Profile spec.