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 Emmanuel LAB
Recipients Emmanuel LAB
Date 2011-02-08.15:22:15
SpamBayes Score 1.861831e-08
Marked as misclassified No
Message-id <1297178536.07.0.390050074188.issue11152@psf.upfronthosting.co.za>
In-reply-to
Content
Detected in Python version:
Python 2.6.3 (r263rc1:75186, Oct  2 2009, 20:40:30) [MSC v.1500 32 bit (Intel)] on win32

Error in zipfile module: Zip files with no compressed files may contain only 
   [end of central directory record] bloc
without anything else. In that case, when _EndRecData(fpin) function tries to call:
         return _EndRecData64(fpin, -sizeEndCentDir, endrec)
it makes _EndRecData64() trying to seek data in the file before the beginning of the file and generates IOError "Invalid Argument" which is :
* either badly (in is_zipfile()), 
* or not catched (in __init()__._GetContents()._RealGetContents().EndRecData()).

Correction seems easy (not tested) and just need to replace:
        # Try to read the "Zip64 end of central directory" structure
        return _EndRecData64(fpin, -sizeEndCentDir, endrec)
by:
        # check if other block are present
        if filesize > sizeEndCentDir:
            # Try to read the "Zip64 end of central directory" structure
            return _EndRecData64(fpin, -sizeEndCentDir, endrec)
        else:
        		# no other block present
            return endrec
History
Date User Action Args
2011-02-08 15:22:16Emmanuel LABsetrecipients: + Emmanuel LAB
2011-02-08 15:22:16Emmanuel LABsetmessageid: <1297178536.07.0.390050074188.issue11152@psf.upfronthosting.co.za>
2011-02-08 15:22:15Emmanuel LABlinkissue11152 messages
2011-02-08 15:22:15Emmanuel LABcreate