mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-118107: Fix zipimporter ZIP64 handling. (GH-118108)
Add missing import to code that handles too large files and offsets. Use list, not tuple, for a mutable sequence. Add tests to prevent similar mistakes. --------- Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org> Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
This commit is contained in:
parent
698417f2f6
commit
49258efada
7 changed files with 128 additions and 3 deletions
|
@ -517,8 +517,9 @@ def _read_directory(archive):
|
|||
num_extra_values = (len(extra_data) - 4) // 8
|
||||
if num_extra_values > 3:
|
||||
raise ZipImportError(f"can't read header extra: {archive!r}", path=archive)
|
||||
values = struct.unpack_from(f"<{min(num_extra_values, 3)}Q",
|
||||
extra_data, offset=4)
|
||||
import struct
|
||||
values = list(struct.unpack_from(f"<{min(num_extra_values, 3)}Q",
|
||||
extra_data, offset=4))
|
||||
|
||||
# N.b. Here be dragons: the ordering of these is different than
|
||||
# the header fields, and it's really easy to get it wrong since
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue