Skip to content

Commit 68a8a2f

Browse files
authored
Merge pull request #463 from onekey-sec/462-fix-zip64-indicator-checking
fix(handlers): improve ZIP handler to support known indicators of ZIP64
2 parents 29d5ed6 + f887870 commit 68a8a2f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

unblob/handlers/archive/zip.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,15 @@ def has_encrypted_files(
101101

102102
@staticmethod
103103
def is_zip64_eocd(end_of_central_directory: Instance):
104-
return end_of_central_directory.offset_of_cd == 0xFFFFFFFF
104+
# see https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.1.TXT section J
105+
return (
106+
end_of_central_directory.disk_number == 0xFFFF
107+
or end_of_central_directory.disk_number_with_cd == 0xFFFF
108+
or end_of_central_directory.disk_entries == 0xFFFF
109+
or end_of_central_directory.total_entries == 0xFFFF
110+
or end_of_central_directory.central_directory_size == 0xFFFFFFFF
111+
or end_of_central_directory.offset_of_cd == 0xFFFFFFFF
112+
)
105113

106114
def _parse_zip64(self, file: File, start_offset: int, offset: int) -> int:
107115
file.seek(start_offset, io.SEEK_SET)

0 commit comments

Comments
 (0)