mirror of
https://github.com/dgelessus/python-rsrcfork.git
synced 2024-12-22 02:29:56 +00:00
Allow compressed resource header length field to be 0 (see #10)
This commit is contained in:
parent
8f60fcdfc4
commit
a2663ae85d
@ -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,
|
* Added `open` and `open_raw` methods to `Resource` objects,
|
||||||
for stream-based access to resource data.
|
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
|
### Version 1.8.0
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ class CompressedHeaderInfo(object):
|
|||||||
raise DecompressError("Invalid header")
|
raise DecompressError("Invalid header")
|
||||||
if signature != COMPRESSED_SIGNATURE:
|
if signature != COMPRESSED_SIGNATURE:
|
||||||
raise DecompressError(f"Invalid signature: {signature!r}, expected {COMPRESSED_SIGNATURE!r}")
|
raise DecompressError(f"Invalid signature: {signature!r}, expected {COMPRESSED_SIGNATURE!r}")
|
||||||
if header_length != 0x12:
|
if header_length not in {0, 0x12}:
|
||||||
raise DecompressError(f"Unsupported header length: 0x{header_length:>04x}, expected 0x12")
|
raise DecompressError(f"Unsupported header length value: 0x{header_length:>04x}, expected 0x12 or 0")
|
||||||
|
|
||||||
if compression_type == COMPRESSED_TYPE_8:
|
if compression_type == COMPRESSED_TYPE_8:
|
||||||
working_buffer_fractional_size, expansion_buffer_size, dcmp_id, reserved = STRUCT_COMPRESSED_TYPE_8_HEADER.unpack(remainder)
|
working_buffer_fractional_size, expansion_buffer_size, dcmp_id, reserved = STRUCT_COMPRESSED_TYPE_8_HEADER.unpack(remainder)
|
||||||
|
Loading…
Reference in New Issue
Block a user