mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Close #17666: Fix reading gzip files with an extra field.
This commit is contained in:
commit
ffcd339aac
3 changed files with 11 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue