[New-bugs-announce] [issue46931] zipfile library will raise uncaught oserror when reading length incorrect zip file

Vertu Joe report at bugs.python.org
Sat Mar 5 12:37:33 EST 2022


New submission from Vertu Joe <ultimalium at gmail.com>:

I intentionally made some corrupted zip archive files for testing.
If some contents were removed from the archive instead of changing the bits. when trying to read such files, the zipfile will raise an uncaught  OSError, instead of a badzipfile error as expected.

os is windows 10 x64 not sure if this also happens on the UNIX system or it's intended to be happen.

code:

import zipfile
with zipfile.ZipFile(r'damaged.zip') as dmg:
    dmg.testzip()

result:
OSError
[Errno 22] Invalid argument
  File "test.py", line 20, in <module>
    file = dmg.testzip()

----------
components: Library (Lib)
files: damaged.zip
messages: 414590
nosy: ultimalium
priority: normal
severity: normal
status: open
title: zipfile library will raise uncaught oserror when reading length incorrect zip file
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file50658/damaged.zip

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


More information about the New-bugs-announce mailing list