[New-bugs-announce] [issue7467] The zipfile module does not check files' CRCs, including in ZipFile.testzip
report at bugs.python.org
Thu Dec 10 07:59:31 CET 2009
New submission from Douglas Turk <douglas.turk at depthanalysis.com>:
The zipfile module does not calculate the CRC of files in a zipfile as
they are read as of Python 2.6. The old ZipFile.read function in Python
2.5 used to do this, and ZipFile.testzip appears to rely on ZipFile.read
to check the CRC. This means that ZipFile.testzip does not check the CRC
as it is documented to.
It would be useful if ZipExtFile could check the CRC once it had read
all the data, because this would mean that e.g. ZipFile.extract would
also automatically check the CRC. Perhaps ZipExtFile.read could raise a
BadZipFile exception if it reaches EOF and the CRC is wrong.
Steps to reproduce:
-Create a zip file, then change a byte in a file's contents (easiest if
files are stored, not deflated).
-Run ZipFile.testzip on the edited file. Note that it does not report a
CRC failure, but other zip tools do.
I can provide a patch in a couple of days if that's useful.
components: Library (Lib)
title: The zipfile module does not check files' CRCs, including in ZipFile.testzip
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file15515/test.zip
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce