summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r--Lib/zipfile.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index b5c16db..8a19ca2 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -438,7 +438,9 @@ class ZipInfo (object):
unpack = struct.unpack
while len(extra) >= 4:
tp, ln = unpack('<HH', extra[:4])
- if tp == 1:
+ if ln+4 > len(extra):
+ raise BadZipFile("Corrupt extra field %04x (size=%d)" % (tp, ln))
+ if tp == 0x0001:
if ln >= 24:
counts = unpack('<QQQ', extra[4:28])
elif ln == 16: