[New-bugs-announce] [issue39018] IndexError exception on corrupted zip file

jvoisin report at bugs.python.org
Tue Dec 10 11:47:07 EST 2019

New submission from jvoisin <jvoisin at google.com>:

The attached file raises an `IndexError: tuple index out of range` exception when trying to open it with `zipfile.Zipfile('crash-23b7d72644702df94bfcfaab4c25b01ff31c0b38')`, with the following stacktrace:

$ cat test_zip.py
import zipfile
import sys

with zipfile.ZipFile(sys.argv[1]) as f:
$ python3 ./test_zip.py ./crash-23b7d72644702df94bfcfaab4c25b01ff31c0b38
Traceback (most recent call last):
  File "./test_zip.py", line 4, in <module>
    with zipfile.ZipFile(sys.argv[1]) as f:
  File "/usr/lib/python3.7/zipfile.py", line 1225, in __init__
  File "/usr/lib/python3.7/zipfile.py", line 1348, in _RealGetContents
  File "/usr/lib/python3.7/zipfile.py", line 480, in _decodeExtra
    self.file_size = counts[idx]
IndexError: tuple index out of range


The zipfile documentation doesn't mention that IndexError is a possible exception for this method.

components: Library (Lib)
files: crash-23b7d72644702df94bfcfaab4c25b01ff31c0b38
messages: 358202
nosy: jvoisin
priority: normal
severity: normal
status: open
title: IndexError exception on corrupted zip file
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file48769/crash-23b7d72644702df94bfcfaab4c25b01ff31c0b38

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list