summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-01-06 20:12:07 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-01-06 20:12:07 (GMT)
commit93a59653a49d60abaeb69a966370b4277e0f1d3a (patch)
tree5e12375afe1fec6807011469502cc10ef721f169 /Lib/zipfile.py
parent875e1e7b7c972f76bf05a7f4caacef47da5c846c (diff)
downloadcpython-93a59653a49d60abaeb69a966370b4277e0f1d3a.zip
cpython-93a59653a49d60abaeb69a966370b4277e0f1d3a.tar.gz
cpython-93a59653a49d60abaeb69a966370b4277e0f1d3a.tar.bz2
Merged revisions 74246 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r74246 | amaury.forgeotdarc | 2009-07-28 18:18:57 -0400 (Tue, 28 Jul 2009) | 10 lines Merged revisions 74245 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r74245 | amaury.forgeotdarc | 2009-07-29 00:15:30 +0200 (mer., 29 juil. 2009) | 3 lines #6511: ZipFile will now raise BadZipfile when opening an empty or tiny file, like it does for larger invalid files. ........ ................
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r--Lib/zipfile.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 6357b94..79ca152 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -200,7 +200,10 @@ def _EndRecData(fpin):
# Check to see if this is ZIP file with no archive comment (the
# "end of central directory" structure should be the last item in the
# file if this is the case).
- fpin.seek(-sizeEndCentDir, 2)
+ try:
+ fpin.seek(-sizeEndCentDir, 2)
+ except IOError:
+ return None
data = fpin.read()
if data[0:4] == stringEndArchive and data[-2:] == b"\000\000":
# the signature is correct and there's no comment, unpack structure