Skip to content

Commit c62a455

Browse files
committed
Optimize code and revise comment
- According to ZIP spec, both uncompressed and compressed size should be 0xffffffff when zip64 is used.
1 parent 81a419a commit c62a455

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Lib/zipfile/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,14 +1619,11 @@ def _validate_local_file_entry(self, fp, offset, end_offset):
16191619
# According to the spec, these fields should be zero when data
16201620
# descriptor is used. Otherwise treat as a false positive on
16211621
# random bytes to return early, as scanning for data descriptor
1622-
# is rather intensive.
1622+
# is rather expensive.
16231623
if not (zinfo.CRC == zinfo.compress_size == zinfo.file_size == 0):
16241624
return None
16251625

1626-
zip64 = (
1627-
fheader[_FH_UNCOMPRESSED_SIZE] == 0xffffffff or
1628-
fheader[_FH_COMPRESSED_SIZE] == 0xffffffff
1629-
)
1626+
zip64 = fheader[_FH_UNCOMPRESSED_SIZE] == 0xffffffff
16301627

16311628
dd = self._scan_data_descriptor(fp, pos, end_offset, zip64)
16321629
if dd is None and not self.strict_descriptor:

0 commit comments

Comments
 (0)