This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dougturk
Recipients dougturk
Date 2009-12-10.06:59:28
SpamBayes Score 4.1240638e-09
Marked as misclassified No
Message-id <1260428371.84.0.68619284631.issue7467@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-12-10 06:59:32dougturksetrecipients: + dougturk
2009-12-10 06:59:31dougturksetmessageid: <1260428371.84.0.68619284631.issue7467@psf.upfronthosting.co.za>
2009-12-10 06:59:30dougturklinkissue7467 messages
2009-12-10 06:59:29dougturkcreate