[issue44067] Zipfile lib overwrites the extra field during closing when the archive size is more then ZIP64_LIMIT

AMRIT RAI report at bugs.python.org
Fri May 7 04:41:46 EDT 2021


AMRIT RAI <shaanbhaya at gmail.com> added the comment:

The issue stems from the following code inside the 
def _write_end_record(self): method ,where the extra fields are trimmed .

if zinfo.header_offset > ZIP64_LIMIT:
    extra.append(zinfo.header_offset)
    header_offset = 0xffffffff
else:
    header_offset = zinfo.header_offset

extra_data = zinfo.extra
min_version = 0
if extra:
    # Append a ZIP64 field to the extra's
    extra_data = _strip_extra(extra_data, (1,))
    extra_data = struct.pack(
        '<HH' + 'Q'*len(extra),
        1, 8*len(extra), *extra) + extra_data

min_version = ZIP64_VERSION

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44067>
_______________________________________


More information about the Python-bugs-list mailing list