mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-29774: Improve error reporting for corrupted extra field in ZIP file. (#583)
This commit is contained in:
parent
964281af59
commit
feccdb2a24
1 changed files with 3 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue