Skip to content

Commit

Permalink
Add uncompressed chunk padding (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Starwarsfan2099 committed Aug 12, 2021
1 parent 2629bf5 commit 94a3583
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pyaff4/aff4_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ def read(self, _):
self.bevy_length += compressedLen
return compressed_chunk
else:
# On final chunks that aren't compressed, pad if they are less than chunk_size
# so that at decompression we won't try to decompress an already decompressed chunk.
if chunkLen < self.owner.chunk_size:
padding = self.owner.chunk_size - chunkLen
chunk += b"\x00" * padding
self.bevy_index.append((self.bevy_length, self.owner.chunk_size))
self.bevy_length += self.owner.chunk_size
return chunk
Expand Down

0 comments on commit 94a3583

Please sign in to comment.