#15546: Fix {GzipFile,LZMAFile}.read1()'s handling of pathological input data.

This commit is contained in:
Nadeem Vawda 2012-08-05 02:19:09 +02:00
parent 9c92a691e1
commit 37d3ff1487
3 changed files with 33 additions and 22 deletions

View file

@ -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: