cpython/Lib/zipfile
Miss Islington (bot) af428a3894
[3.14] gh-72680: Fix false positives when using zipfile.is_zipfile() (GH-134250) (#134401)
gh-72680: Fix false positives when using zipfile.is_zipfile() (GH-134250)

bpo-28494: Improve zipfile.is_zipfile reliability

The zipfile.is_zipfile function would only search for the EndOfZipfile
section header. This failed to correctly identify non-zipfiles that
contained this header. Now the zipfile.is_zipfile function verifies
the first central directory entry.

Changes:
* Extended zipfile.is_zipfile to verify zipfile catalog
* Added tests to validate failure of binary non-zipfiles
* Reuse 'concat' handling for is_zipfile
(cherry picked from commit 1298511b41)

Co-authored-by: Tim Hatch <timhatch@netflix.com>
Co-authored-by: John Jolly <john.jolly@gmail.com>
2025-05-21 01:58:48 +00:00
..
_path gh-133306: Use \z instead of \Z in regular expressions in the stdlib (GH-133337) 2025-05-03 17:58:49 +03:00
__init__.py [3.14] gh-72680: Fix false positives when using zipfile.is_zipfile() (GH-134250) (#134401) 2025-05-21 01:58:48 +00:00
__main__.py