[New-bugs-announce] [issue36993] zipfile: tuple IndexError on extract

alter-bug-tracer report at bugs.python.org
Tue May 21 08:32:49 EDT 2019


New submission from alter-bug-tracer <emanuel.vintila at abugtracer.ro>:

The following code throws an IndexError when attempting to extract a malformed archive (attached):

import zipfile
import sys

zf = zipfile.ZipFile(sys.argv[1])
for info in zf.infolist():
  zf.extract(info.filename)

Result:
Traceback (most recent call last):
  File "code.py", line 4, in <module>
    zf = zipfile.ZipFile(sys.argv[1])
  File "/usr/local/lib/python3.8/zipfile.py", line 1230, in __init__
    self._RealGetContents()
  File "/usr/local/lib/python3.8/zipfile.py", line 1353, in _RealGetContents
    x._decodeExtra()
  File "/usr/local/lib/python3.8/zipfile.py", line 480, in _decodeExtra
    self.file_size = counts[idx]
IndexError: tuple index out of range

----------
files: index_tuple.zip
messages: 343038
nosy: alter-bug-tracer
priority: normal
severity: normal
status: open
title: zipfile: tuple IndexError on extract
versions: Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file48348/index_tuple.zip

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36993>
_______________________________________


More information about the New-bugs-announce mailing list