summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-04-08 19:35:02 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-04-08 19:35:02 (GMT)
commit7e69f0085e5365347bf00f4ed08d07e5f4785a96 (patch)
treeb028993963f97dd40a197d0de4e9568c86102c2a /Lib/gzip.py
parentb0f9fa7a03ed56c2155fb251fbd423637dc86536 (diff)
downloadcpython-7e69f0085e5365347bf00f4ed08d07e5f4785a96.zip
cpython-7e69f0085e5365347bf00f4ed08d07e5f4785a96.tar.gz
cpython-7e69f0085e5365347bf00f4ed08d07e5f4785a96.tar.bz2
Close #17666: Fix reading gzip files with an extra field.
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index d7da02c..a1f13b4 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -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: