--- /usr/lib/python2.7/zipfile.py 2016-07-02 21:02:36.000000000 +0200 +++ zf.py 2016-10-21 00:02:26.864716094 +0200 @@ -247,7 +247,10 @@ return None endrec = list(struct.unpack(structEndArchive, recData)) commentSize = endrec[_ECD_COMMENT_SIZE] #as claimed by the zip file - comment = data[start+sizeEndCentDir:start+sizeEndCentDir+commentSize] + comment = data[start+sizeEndCentDir:] + if len(comment) != commentSize: + # likely not a zip file, but a file that just contains the magic + return None endrec.append(comment) endrec.append(maxCommentStart + start)