[New-bugs-announce] [issue16735] zipfile.is_zipfile wrongly recognizes non-zip as zip

Bohuslav "Slavek" Kabrda report at bugs.python.org
Thu Dec 20 09:30:11 CET 2012

New submission from Bohuslav "Slavek" Kabrda:

When I use zipfile.is_zipfile on file fastjar (sample uploaded at [1]) from libgcj, I get True, while I should get False (reproducible with fastjar from libgcj 4.7.2 on Fedora 18).
This is caused by stringEndArchive string being present in the file, but the file still isn't zip. Would it be possible to add some further checks to eliminate this kind of errors? I'd like to submit a patch but I'm not sure what to check for, maybe some other constants mentioned in the ZIP format definition?

Thanks a lot.

[1] http://bkabrda.fedorapeople.org/fastjar

components: Library (Lib)
messages: 177804
nosy: bkabrda
priority: normal
severity: normal
status: open
title: zipfile.is_zipfile wrongly recognizes non-zip as zip
versions: Python 2.7, Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list