Skip to content

Commit fd3cc55

Browse files
committed
fix(zip): handle ZIP64 files missing indicators of ZIP64 (fix).
We should still raise an exception if offset is not bound, otherwise we have an unhandled 'UnboundLocalError'.
1 parent 63a8408 commit fd3cc55

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

unblob/handlers/archive/zip.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ def calculate_chunk(self, file: File, start_offset: int) -> Optional[ValidChunk]
188188
if offset == end_of_central_directory_offset:
189189
break
190190
else:
191-
# if we can't find 32bit ZIP EOCD, we fall back to ZIP64
191+
if offset is None:
192+
raise InvalidInputFormat("Missing EOCD record header in ZIP chunk.")
193+
# if we can't find a valid 32bit ZIP EOCD, we fall back to ZIP64
192194
end_of_central_directory = self._parse_zip64(file, start_offset, offset)
193195

194196
has_encrypted_files = self.has_encrypted_files(

0 commit comments

Comments
 (0)