diff options
author | Daniel Hillier <daniel.hillier@gmail.com> | 2019-10-29 07:24:18 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-10-29 07:24:18 (GMT) |
commit | da6ce58dd5ac109485af45878fca6bfd265b43e9 (patch) | |
tree | 05b7f6dc9bcdc8cd6b9a781da8a1caeb9b344399 /Lib/zipfile.py | |
parent | 4c155f738dc2e70ccb574f5169ad89c01753c6f7 (diff) | |
download | cpython-da6ce58dd5ac109485af45878fca6bfd265b43e9.zip cpython-da6ce58dd5ac109485af45878fca6bfd265b43e9.tar.gz cpython-da6ce58dd5ac109485af45878fca6bfd265b43e9.tar.bz2 |
bpo-36993: Improve error reporting for zipfiles with bad zip64 extra data. (GH-14656)
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r-- | Lib/zipfile.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py index 6201edc..6504e0e 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -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 |