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

This commit is contained in:
Serhiy Storchaka 2013-04-08 22:37:15 +03:00
commit ffcd339aac
3 changed files with 11 additions and 1 deletions

View file

@ -302,7 +302,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: