From: Tim Hatch Date: Mon, 20 Feb 2023 17:07:03 +0000 (-0800) Subject: gh-88233: zipfile: handle extras after a zip64 extra (GH-96161) X-Git-Tag: v3.12.0a6~118 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=59e86caca812fc993c5eb7dc8ccd1508ffccba86;p=thirdparty%2FPython%2Fcpython.git gh-88233: zipfile: handle extras after a zip64 extra (GH-96161) Previously, any data _after_ the zip64 extra would be removed. With many new tests. Fixes #88233 Automerge-Triggered-By: GH:jaraco --- diff --git a/Lib/test/test_zipfile/test_core.py b/Lib/test/test_zipfile/test_core.py index cf41d0e8cb8d..e23f5c2a8556 100644 --- a/Lib/test/test_zipfile/test_core.py +++ b/Lib/test/test_zipfile/test_core.py @@ -3010,5 +3010,67 @@ class EncodedMetadataTests(unittest.TestCase): self.assertIn(name, listing) +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("