8000 [3.14] gh-72680: Fix false positives when using zipfile.is_zipfile() (GH-134250) by miss-islington · Pull Request #134401 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.14] gh-72680: Fix false positives when using zipfile.is_zipfile() (GH-134250) #134401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025

Conversation

miss-islington
Copy link
Contributor
@miss-islington miss-islington commented May 21, 2025

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 1298511)

Co-authored-by: Tim Hatch timhatch@netflix.com
Co-authored-by: John Jolly john.jolly@gmail.com

…ythonGH-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 1298511)

Co-authored-by: Tim Hatch <timhatch@netflix.com>
Co-authored-by: John Jolly <john.jolly@gmail.com>
@bedevere-app bedevere-app bot added the sprint label May 21, 2025
@gpshead gpshead self-assigned this May 21, 2025
@gpshead gpshead enabled auto-merge (squash) May 21, 2025 01:33
@gpshead gpshead merged commit af428a3 into python:3.14 May 21, 2025
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0