From 37d3ff14871a25429fb93167aeace0589be45426 Mon Sep 17 00:00:00 2001 From: Nadeem Vawda Date: Sun, 5 Aug 2012 02:19:09 +0200 Subject: #15546: Fix {GzipFile,LZMAFile}.read1()'s handling of pathological input data. --- Lib/gzip.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Lib/gzip.py') diff --git a/Lib/gzip.py b/Lib/gzip.py index 8b8942642e..5bcfe6123a 100644 --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -385,7 +385,10 @@ class GzipFile(io.BufferedIOBase): return b'' try: - self._read() + # For certain input data, a single call to _read() may not return + # any data. In this case, retry until we get some data or reach EOF. + while self.extrasize <= 0: + self._read() except EOFError: pass if size < 0 or size > self.extrasize: -- cgit v1.2.1