asdf-format/asdf

asdf expects that block compression label bytes are valid ascii

Opened this issue · 0 comments

Here is one example:

if compression == comp.label.decode("ascii"):

The standard doesn't mention that these 4 bytes should be limited to the ascii range:
https://asdf-standard.readthedocs.io/en/1.0.3/file_layout.html#block-header

Modifying the LzmaCompressor used in test_compression_with_extension to use label `b"lzm\255" results in a failure at:

labels += [comp.label.decode("ascii")]

UnicodeDecodeError: 'ascii' codec can't decode byte 0xad in position 3: ordinal not in range(128)

I can see the benefit of having these be just ascii (they are human readable when the file is opened with a text editor). If this restriction is ok than the standard should be updated to reflect that these bytes must be ascii.