mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Optimize code and revise comment
- According to ZIP spec, both uncompressed and compressed size should be 0xffffffff when zip64 is used.
This commit is contained in:
parent
81a419aaf7
commit
c62a4556ff
1 changed files with 2 additions and 5 deletions
|
|
@ -1619,14 +1619,11 @@ def _validate_local_file_entry(self, fp, offset, end_offset):
|
|||
# According to the spec, these fields should be zero when data
|
||||
# descriptor is used. Otherwise treat as a false positive on
|
||||
# random bytes to return early, as scanning for data descriptor
|
||||
# is rather intensive.
|
||||
# is rather expensive.
|
||||
if not (zinfo.CRC == zinfo.compress_size == zinfo.file_size == 0):
|
||||
return None
|
||||
|
||||
zip64 = (
|
||||
fheader[_FH_UNCOMPRESSED_SIZE] == 0xffffffff or
|
||||
fheader[_FH_COMPRESSED_SIZE] == 0xffffffff
|
||||
)
|
||||
zip64 = fheader[_FH_UNCOMPRESSED_SIZE] == 0xffffffff
|
||||
|
||||
dd = self._scan_data_descriptor(fp, pos, end_offset, zip64)
|
||||
if dd is None and not self.strict_descriptor:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue