summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-01-09 12:50:20 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-01-09 12:50:20 (GMT)
commit5ce3f10aeea711bb912e948fa5d9f63736df1327 (patch)
tree977da819c4d6e15bb355334b15b88b67d8f52c90 /Lib/zipfile.py
parent78ee3289e991882d803be4cb0dd6b4005f82cbb1 (diff)
downloadcpython-5ce3f10aeea711bb912e948fa5d9f63736df1327.zip
cpython-5ce3f10aeea711bb912e948fa5d9f63736df1327.tar.gz
cpython-5ce3f10aeea711bb912e948fa5d9f63736df1327.tar.bz2
Issue #20078: Reading malformed zipfiles no longer hangs with 100% CPU
consumption.
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r--Lib/zipfile.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 92c98ab..a1b3414 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))