New submission from Douglas Turk <douglas.t...@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) files: test.zip messages: 96194 nosy: dougturk severity: normal status: open title: The zipfile module does not check files' CRCs, including in ZipFile.testzip type: behavior versions: Python 2.6, Python 2.7 Added file: http://bugs.python.org/file15515/test.zip _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7467> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com