8000 [3.6] bpo-34472: Add data descriptor signature to zipfile (GH-8871) by miss-islington · Pull Request #9398 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.6] bpo-34472: Add data descriptor signature to zipfile (GH-8871) #9398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Lib/zipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ class LargeZipFile(Exception):
_CD64_DIRECTORY_SIZE = 8
_CD64_OFFSET_START_CENTDIR = 9

_DD_SIGNATURE = 0x08074b50

_EXTRA_FIELD_STRUCT = struct.Struct('<HH')

def _strip_extra(extra, xids):
Expand Down Expand Up @@ -1031,8 +1033,8 @@ def close(self):
# Write updated header info
if self._zinfo.flag_bits & 0x08:
# Write CRC and file sizes after the file data
fmt = '<LQQ' if self._zip64 else '<LLL'
self._fileobj.write(struct.pack(fmt, self._zinfo.CRC,
fmt = '<LLQQ' if self._zip64 else '<LLLL'
self._fileobj.write(struct.pack(fmt, _DD_SIGNATURE, self._zinfo.CRC,
self._zinfo.compress_size, self._zinfo.file_size))
self._zipfile.start_dir = self._fileobj.tell()
else:
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,7 @@ Roger D. Serwy
Jerry Seutter
Pete Sevander
Denis Severson
Silas Sewell
Ian Seyer
Dmitry Shachnev
Anish Shah
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Improved compatibility for streamed files in :mod:`zipfile`. Previously an
optional signature was not being written and certain ZIP applications were
not supported. Patch by Silas Sewell.
0