Skip to content
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

gh-103861: Fix Zip64 extensions not being properly applied in some cases #103863

Merged
merged 6 commits into from
May 16, 2023

Commits on Apr 27, 2023

  1. Fix Zip64 extensions not being properly applied in some cases

    This commit fixes an issue where adding a small file to a `ZipFile`
    object while forcing zip64 extensions causes an extra Zip64 record to be
    added to the zip, but doesn't update the `min_version` or file sizes.
    
    Fixes python#103861
    pR0Ps committed Apr 27, 2023
    Configuration menu
    Copy the full SHA
    c42700d View commit details
    Browse the repository at this point in the history

Commits on Apr 28, 2023

  1. Fix edge cases in checking if zip64 extensions are required

    This fixes an issue where if data requiring zip64 extensions was added
    to an unseekable stream without specifying `force_zip64=True`, zip64
    extensions would not be used and a RuntimeError would not be raised when
    closing the file (even though the size would be known at that point).
    This would result in successfully writing corrupt zip files.
    
    Deciding if zip64 extensions are required outside of the `FileHeader`
    function means that both `FileHeader` and `_ZipWriteFile` will always be
    in sync. Previously, the `FileHeader` function could enable zip64
    extensions without propagating that decision to the `_ZipWriteFile`
    class, which would then not correctly write the data descriptor record
    or check for errors on close.
    pR0Ps committed Apr 28, 2023
    Configuration menu
    Copy the full SHA
    d24c6a4 View commit details
    Browse the repository at this point in the history

Commits on May 1, 2023

  1. Configuration menu
    Copy the full SHA
    9b66476 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b68e70f View commit details
    Browse the repository at this point in the history

Commits on May 16, 2023

  1. Restore ZipInfo.FileHeader zip64=None default to maintain backwards c…

    …ompatibility in the API.
    
    Code within this module always passes an explicit zip64, so the overall bug fix remains valid. We just don't want to break existing user code constructing their own ZipInfo objects and calling zi.FileHeader themselves for whatever reasons.  _(hopefully rare, but it isn't a protected or private API so we can't make assumptions)_
    gpshead committed May 16, 2023
    Configuration menu
    Copy the full SHA
    ee7c78b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0276ce9 View commit details
    Browse the repository at this point in the history