mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-36993: Improve error reporting for zipfiles with bad zip64 extra data. (GH-14656)
This commit is contained in:
parent
4c155f738d
commit
da6ce58dd5
3 changed files with 236 additions and 0 deletions
|
@ -480,14 +480,26 @@ class ZipInfo (object):
|
|||
|
||||
# ZIP64 extension (large files and/or large archives)
|
||||
if self.file_size in (0xffffffffffffffff, 0xffffffff):
|
||||
if len(counts) <= idx:
|
||||
raise BadZipFile(
|
||||
"Corrupt zip64 extra field. File size not found."
|
||||
)
|
||||
self.file_size = counts[idx]
|
||||
idx += 1
|
||||
|
||||
if self.compress_size == 0xFFFFFFFF:
|
||||
if len(counts) <= idx:
|
||||
raise BadZipFile(
|
||||
"Corrupt zip64 extra field. Compress size not found."
|
||||
)
|
||||
self.compress_size = counts[idx]
|
||||
idx += 1
|
||||
|
||||
if self.header_offset == 0xffffffff:
|
||||
if len(counts) <= idx:
|
||||
raise BadZipFile(
|
||||
"Corrupt zip64 extra field. Header offset not found."
|
||||
)
|
||||
old = self.header_offset
|
||||
self.header_offset = counts[idx]
|
||||
idx+=1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue