mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix issue #14315: The zipfile module now ignores extra fields in the central
directory that are too short to be parsed instead of letting a struct.unpack error bubble up as this "bad data" appears in many real world zip files in the wild and is ignored by other zip tools.
This commit is contained in:
parent
58cfdd8af8
commit
0af8a86be8
3 changed files with 21 additions and 1 deletions
|
@ -411,7 +411,7 @@ class ZipInfo (object):
|
|||
# Try to decode the extra field.
|
||||
extra = self.extra
|
||||
unpack = struct.unpack
|
||||
while extra:
|
||||
while len(extra) >= 4:
|
||||
tp, ln = unpack('<HH', extra[:4])
|
||||
if tp == 1:
|
||||
if ln >= 24:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue