python3/00198-fix-CVE-2013-7338.patch

22 lines
751 B
Diff

# This is a backport of following upstream patch:
# HG changeset patch
# User Serhiy Storchaka <storchaka@gmail.com>
# Date 1389272021 -7200
# Node ID 79ea4ce431b1b10c79f51dcb2aaa0ccb2a8b1d48
# Parent 9e3f5b5bcf7e4c62475bb1126fd0aecbbb9b64ac# Parent 0cf1defd5ac4433b8e36f950ba452103eb417f9f
Issue #20078: Reading malformed zipfiles no longer hangs with 100% CPU
consumption.
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -862,6 +862,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))