diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-08-17 20:23:46 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-08-17 20:23:46 (GMT) |
commit | 4cd6a95dfeb06950a2566e23e7e2bc9eb8c59775 (patch) | |
tree | 829f2adbc38288b3b7ca9c5703ad78d6100c5fe7 /Lib/zipfile.py | |
parent | 9209138ff9f38f227a72a39308c482f59856329e (diff) | |
download | cpython-4cd6a95dfeb06950a2566e23e7e2bc9eb8c59775.zip cpython-4cd6a95dfeb06950a2566e23e7e2bc9eb8c59775.tar.gz cpython-4cd6a95dfeb06950a2566e23e7e2bc9eb8c59775.tar.bz2 |
Merged revisions 65659,65693,65700,65702,65706-65707,65761 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r65659 | martin.v.loewis | 2008-08-12 15:45:21 -0500 (Tue, 12 Aug 2008) | 2 lines
Add Hirokazu Yamamoto.
........
r65693 | georg.brandl | 2008-08-15 13:35:09 -0500 (Fri, 15 Aug 2008) | 2 lines
#3558: Attribute reference binds more tightly than subscription and call.
........
r65700 | antoine.pitrou | 2008-08-15 16:03:21 -0500 (Fri, 15 Aug 2008) | 3 lines
#2676: email/message.py [Message.get_content_type]: Trivial regex hangs on pathological input
........
r65702 | gregory.p.smith | 2008-08-15 18:14:00 -0500 (Fri, 15 Aug 2008) | 2 lines
document that waitpid raises OSError
........
r65706 | benjamin.peterson | 2008-08-15 22:02:41 -0500 (Fri, 15 Aug 2008) | 1 line
fix markup
........
r65707 | benjamin.peterson | 2008-08-15 22:13:07 -0500 (Fri, 15 Aug 2008) | 1 line
note how os.utime should be used for emulating touch
........
r65761 | antoine.pitrou | 2008-08-17 08:06:29 -0500 (Sun, 17 Aug 2008) | 3 lines
fix ZipFile.testzip() to work with very large embedded files
........
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r-- | Lib/zipfile.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py index e4bc019..9e96e93 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -813,9 +813,14 @@ class ZipFile: def testzip(self): """Read all the files and check the CRC.""" + chunk_size = 2 ** 20 for zinfo in self.filelist: try: - self.read(zinfo.filename) # Check CRC-32 + # Read by chunks, to avoid an OverflowError or a + # MemoryError with very large embedded files. + f = self.open(zinfo.filename, "r") + while f.read(chunk_size): # Check CRC-32 + pass except BadZipfile: return zinfo.filename |