From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 28 Mar 2023 08:58:51 +0000 (-0700) Subject: [3.10] gh-88233: zipfile: handle extras after a zip64 extra (GH-96161) (#102087) X-Git-Tag: v3.10.11~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d445147dfa04bfd52f1cfa7058f4428ca4c7c694;p=thirdparty%2FPython%2Fcpython.git [3.10] gh-88233: zipfile: handle extras after a zip64 extra (GH-96161) (#102087) Previously, any data _after_ the zip64 extra would be removed. With many new tests. Fixes GH-88233 (cherry picked from commit 59e86caca812fc993c5eb7dc8ccd1508ffccba86) Co-authored-by: Tim Hatch --- diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index c7371f59859e..3495fc6548b4 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -3221,5 +3221,67 @@ with zipfile.ZipFile(io.BytesIO(), "w") as zf: zf.extractall(source_path.parent) +class StripExtraTests(unittest.TestCase): + # Note: all of the "z" characters are technically invalid, but up + # to 3 bytes at the end of the extra will be passed through as they + # are too short to encode a valid extra. + + ZIP64_EXTRA = 1 + + def test_no_data(self): + s = struct.Struct("