From 5ce3f10aeea711bb912e948fa5d9f63736df1327 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 9 Jan 2014 14:50:20 +0200 Subject: Issue #20078: Reading malformed zipfiles no longer hangs with 100% CPU consumption. --- Lib/zipfile.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Lib/zipfile.py') diff --git a/Lib/zipfile.py b/Lib/zipfile.py index 92c98abe1e..a1b34147f8 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -860,6 +860,8 @@ class ZipExtFile(io.BufferedIOBase): data = self._fileobj.read(n) self._compress_left -= len(data) + if not data: + raise EOFError if self._decrypter is not None: data = bytes(map(self._decrypter, data)) -- cgit v1.2.1