diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-08-05 00:19:09 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-08-05 00:19:09 (GMT) |
commit | 37d3ff14871a25429fb93167aeace0589be45426 (patch) | |
tree | f0053233c44a4013f6f157e4c30984cc83089cbb /Lib/gzip.py | |
parent | 9c92a691e1f0f889fffd22a48d02ceaea38c05c6 (diff) | |
download | cpython-37d3ff14871a25429fb93167aeace0589be45426.zip cpython-37d3ff14871a25429fb93167aeace0589be45426.tar.gz cpython-37d3ff14871a25429fb93167aeace0589be45426.tar.bz2 |
#15546: Fix {GzipFile,LZMAFile}.read1()'s handling of pathological input data.
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r-- | Lib/gzip.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py index 8b89426..5bcfe61 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: |