Close #17666: Fix reading gzip files with an extra field.

This commit is contained in:
Serhiy Storchaka 2013-04-08 22:35:02 +03:00
parent cf86d9441e
commit a6df938fef
3 changed files with 24 additions and 5 deletions

View file

@ -280,7 +280,8 @@ class GzipFile(io.BufferedIOBase):
if flag & FEXTRA:
# Read & discard the extra field, if present
self._read_exact(struct.unpack("<H", self._read_exact(2)))
extra_len, = struct.unpack("<H", self._read_exact(2))
self._read_exact(extra_len)
if flag & FNAME:
# Read and discard a null-terminated string containing the filename
while True: