From 0af8a86be85ecf1899d0770c6d31541128ea8cad Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Thu, 29 May 2014 23:42:14 -0700 Subject: 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. --- Lib/zipfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/zipfile.py') diff --git a/Lib/zipfile.py b/Lib/zipfile.py index 7b6bd5f809..ee228b1475 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('= 24: -- cgit v1.2.1