[issue28494] is_zipfile false positives

Thomas Waldmann report at bugs.python.org
Thu Oct 20 18:26:45 EDT 2016


Thomas Waldmann added the comment:

patch for py2.7

The EOCD structure is at EOF.

It either does not contain a comment (this is what the existing code checks first) or it contains a comment of the length that is specified in the structure.

The patch checks consistency specified length vs. real length (end of fixed part of structure up to EOF). If this does not match, it is likely not a zip file, but just a file that happens to have the magic 4 bytes somewhere in its last 64kB.

----------
keywords: +patch
Added file: http://bugs.python.org/file45164/isz_fail_fix.diff

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


More information about the Python-bugs-list mailing list