summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2014-05-30 06:42:14 (GMT)
committerGregory P. Smith <greg@krypto.org>2014-05-30 06:42:14 (GMT)
commit0af8a86be85ecf1899d0770c6d31541128ea8cad (patch)
tree8df8ec9805b36de4d5093109b84a0feb34a8ff00 /Lib/zipfile.py
parent58cfdd8af80f2ffa44b207e0846ddbe7f73836cb (diff)
downloadcpython-0af8a86be85ecf1899d0770c6d31541128ea8cad.zip
cpython-0af8a86be85ecf1899d0770c6d31541128ea8cad.tar.gz
cpython-0af8a86be85ecf1899d0770c6d31541128ea8cad.tar.bz2
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.
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r--Lib/zipfile.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 7b6bd5f..ee228b1 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -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: