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)
commita6df938fefd5b51d85a45cf3f29f60ee7bb21edf (patch)
treed2a5dd6baa1c9b84b7f17526513ecbb5d18c2f1a /Lib/gzip.py
parentcf86d9441ed09f0b7265a0a869c110f245336228 (diff)
downloadcpython-a6df938fefd5b51d85a45cf3f29f60ee7bb21edf.zip
cpython-a6df938fefd5b51d85a45cf3f29f60ee7bb21edf.tar.gz
cpython-a6df938fefd5b51d85a45cf3f29f60ee7bb21edf.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 8fb1ed0..0adfd3f 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -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: