[issue34606] Unable to read zip file with extra
Kyle Altendorf
report at bugs.python.org
Fri Sep 7 16:57:12 EDT 2018
Kyle Altendorf <sda at fstab.net> added the comment:
Turns out the docs do document this. My apologies.
https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
4.3.11 Archive extra data record:
archive extra data signature 4 bytes (0x08064b50)
extra field length 4 bytes
extra field data (variable size)
Aside from the discrepancy between 16-bits and 4 bytes, it seems like something should happen, even if it's something other than 'fixing' the code to handle the malformed data. Isn't it a bug for zipfile to create a non-compliant file? Shouldn't it either check or provide an interface by which a compliant file could sensibly be created? It doesn't seem great to just expect users to rewrite this each time they call.
(42).to_bytes(4, 'little') + len(data).to_bytes(4, 'little') + data
or, should it be 'big'? and would it be (len(data) + 4 + 4)?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34606>
_______________________________________
More information about the Python-bugs-list
mailing list