diff --git a/README.md b/README.md index 1b43fa3..4419d02 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,8 @@ see the ["resource forks" section of the mac_file_format_docs repo](https://gith * Added `open` and `open_raw` methods to `Resource` objects, for stream-based access to resource data. +* Fixed reading of compressed resource headers with the header length field incorrectly set to 0 + (because real Mac OS apparently accepts this). ### Version 1.8.0 diff --git a/src/rsrcfork/compress/common.py b/src/rsrcfork/compress/common.py index 87c6c7c..8eedcee 100644 --- a/src/rsrcfork/compress/common.py +++ b/src/rsrcfork/compress/common.py @@ -46,8 +46,8 @@ class CompressedHeaderInfo(object): raise DecompressError("Invalid header") if signature != COMPRESSED_SIGNATURE: raise DecompressError(f"Invalid signature: {signature!r}, expected {COMPRESSED_SIGNATURE!r}") - if header_length != 0x12: - raise DecompressError(f"Unsupported header length: 0x{header_length:>04x}, expected 0x12") + if header_length not in {0, 0x12}: + raise DecompressError(f"Unsupported header length value: 0x{header_length:>04x}, expected 0x12 or 0") if compression_type == COMPRESSED_TYPE_8: working_buffer_fractional_size, expansion_buffer_size, dcmp_id, reserved = STRUCT_COMPRESSED_TYPE_8_HEADER.unpack(remainder)