Skip to content

Decoder can't catch errors in CAT021/RE (wrong length) and silently skips to next datablock #252

@ifsnop

Description

@ifsnop

Reported length of the datablock is 5D = 93 bytes. There are 93 bytes on the datablock.

root@host# echo "15 00 5D F3 1B 7B 6B D3 A7 04 14 D8 01 01 00 00 8A 01 0E E6 37 53 01 13 CA 6C 39 64 F2 54 62 13 54 62 1E 17 18 31 F3 15 B0 12 0F A0 05 C8 40 00 14 08 E9 7D 51 54 62 51 10 12 31 C3 0C E0 15 00 5A F3 1B 73 6B D3 A7 04 14 D8 01 01 00 00 08 01 0F 08 FA 94 01 D8 65 36 4D 20 67 54 62" | xxd -r -p | asterix_d -d asterix.ini
[...]
ERROR:   Mar 17 15:03:15 2026 (asterixformat.cxx) DataItem::parse needed length=2 , and there is only 0 : [  ]
ERROR:   Mar 17 15:03:15 2026 (asterixformat.cxx) Wrong length in DataItem format for CAT021/I040
ERROR:   Mar 17 15:03:15 2026 (asterixformat.cxx) Data Record bytes: [ 62 ]
ERROR:   Mar 17 15:03:15 2026 (asterixformat.cxx) Wrong data length in Explicit. Needed=11 and there is 7 bytes.

Everything is ok until the decoding of the Reserved Expansion:

08 FA 94 01 D8 65 36 4D 20 67 54 62

08 bytes of length reported, but 12 bytes in the content. So decoder ends in the 8th byte, and feeds the remaining bytes (20 67 54 62) to the decoder.

Then, I honestly don't know what the decoder process does with these bytes (20 67 54 62). Are they parsed as fspec (20) and then reported as I021/161 (67 54), and again another fspec (62), and when going to decode I021/040 no bytes are left?

Can we protect somehow against this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions