From a263718a19eb7828b114a2634d2fe8895c42dbf6 Mon Sep 17 00:00:00 2001 From: Tim Hatch Date: Sun, 21 Aug 2022 10:33:00 -0700 Subject: [PATCH] zipfile: handle extras after a zip64 extra Previously, any data _after_ the zip64 extra would be removed. With many new tests. Fixes #88233 --- Lib/test/test_zipfile.py | 52 ++++++++++++++++++++++++++++++++++++++++ Lib/zipfile.py | 2 ++ 2 files changed, 54 insertions(+) diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index 6f6f4bc26b0d40..9d4925d26bd12e 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -3425,6 +3425,58 @@ def test_cli_with_metadata_encoding_extract(self): for name in self.file_names: 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. + def test_no_data(self): + s = struct.Struct("