Commit feccdb2a authored by Serhiy Storchaka's avatar Serhiy Storchaka Committed by Victor Stinner

bpo-29774: Improve error reporting for corrupted extra field in ZIP file. (#583)

parent 964281af
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment