Commit fc6e8aab authored by Serhiy Storchaka's avatar Serhiy Storchaka

#15546: Fix GzipFile.peek()'s handling of pathological input data.

This is a backport of changeset 8c07ff7f882f.
parent f186911e
...@@ -367,6 +367,8 @@ class GzipFile(io.BufferedIOBase): ...@@ -367,6 +367,8 @@ class GzipFile(io.BufferedIOBase):
if self.fileobj is None: if self.fileobj is None:
return b'' return b''
try: try:
# Ensure that we don't return b"" if we haven't reached EOF.
while self.extrasize == 0:
# 1024 is the same buffering heuristic used in read() # 1024 is the same buffering heuristic used in read()
self._read(max(n, 1024)) self._read(max(n, 1024))
except EOFError: except EOFError:
......
...@@ -466,6 +466,9 @@ Library ...@@ -466,6 +466,9 @@ Library
- Issue #15424: Add a __sizeof__ implementation for array objects. - Issue #15424: Add a __sizeof__ implementation for array objects.
Patch by Ludwig Hähne. Patch by Ludwig Hähne.
- Issue #15546: Fix handling of pathological input data in the peek() method
of the GzipFile class.
- Issue #13052: Fix IDLE crashing when replace string in Search/Replace dialog - Issue #13052: Fix IDLE crashing when replace string in Search/Replace dialog
ended with '\'. Patch by Roger Serwy. ended with '\'. Patch by Roger Serwy.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment