[New-bugs-announce] [issue6511] zipfile: Invalid argument when opening zero-sized files

Sridhar Ratnakumar report at bugs.python.org
Sat Jul 18 05:05:25 CEST 2009


New submission from Sridhar Ratnakumar <sridharr at activestate.com>:

Ideally, zipfile.BadZipFile should be thrown when trying to open files 
that are zero-sized.

sridharr at whymac:/tmp/i > apy -c "import zipfile; zipfile.ZipFile
('empty.zip').extractall()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
zipfile.py", line 693, in __init__
    self._GetContents()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
zipfile.py", line 713, in _GetContents
    self._RealGetContents()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
zipfile.py", line 723, in _RealGetContents
    endrec = _EndRecData(fp)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
zipfile.py", line 189, in _EndRecData
    fpin.seek(-sizeEndCentDir, 2)
IOError: [Errno 22] Invalid argument
sridharr at whymac:/tmp/i >

----------
components: Library (Lib)
messages: 90653
nosy: srid
severity: normal
status: open
title: zipfile: Invalid argument when opening zero-sized files
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6511>
_______________________________________


More information about the New-bugs-announce mailing list