mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-89739: gh-77140: Support zip64 in zipimport (GH-94146)
* Reads zip64 files as produced by the zipfile module * Include tests (somewhat slow, however, because of the need to create "large" zips) * About the same amount of strictness reading invalid zip files as zipfile has * Still works on files with prepended data (like pex) There are a lot more test cases at https://github.com/thatch/zipimport64/ that give me confidence that this works for real-world files. Fixes #89739 and #77140. --------- Co-authored-by: Itamar Ostricher <itamarost@gmail.com> Reviewed-by: Gregory P. Smith <greg@krypto.org>
This commit is contained in:
parent
2cedd25c14
commit
b44898299a
6 changed files with 154 additions and 39 deletions
|
@ -81,6 +81,11 @@ def _pack_uint32(x):
|
|||
return (int(x) & 0xFFFFFFFF).to_bytes(4, 'little')
|
||||
|
||||
|
||||
def _unpack_uint64(data):
|
||||
"""Convert 8 bytes in little-endian to an integer."""
|
||||
assert len(data) == 8
|
||||
return int.from_bytes(data, 'little')
|
||||
|
||||
def _unpack_uint32(data):
|
||||
"""Convert 4 bytes in little-endian to an integer."""
|
||||
assert len(data) == 4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue