[issue24686] zipfile is intolerant of extra bytes

Ronald Oussoren report at bugs.python.org
Thu Jul 23 08:47:50 CEST 2015


Ronald Oussoren added the comment:

The actual exception you're getting is IMHO a bug, it should have been a zipfile.BadZipfile exception.

That said, it might be useful to teach zipfile to optionally be a little more forgiving about errors like this when reading a zipfile. I'm at best -0 on that in general, in this case we could get away with restructuring the code a little: a number of ZipInfo attributes are set from "extra" data when the extra data is present and the value in the normal header max-ed out. The code could be changed to not even try to decode the "extra" data when the values in the normal header aren't max-ed out.

BTW. The RuntimeError that's raised in _decodeExtra should also be a BadZipfile exception.

----------
nosy: +alanmcintyre, ronaldoussoren, serhiy.storchaka, twouters

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


More information about the Python-bugs-list mailing list