Skip to content

fix: Malformed ZIP64 file output (#715)#717

Merged
Its-Just-Nans merged 21 commits intomasterfrom
Its-Just-Nans-patch-1
Mar 16, 2026
Merged

fix: Malformed ZIP64 file output (#715)#717
Its-Just-Nans merged 21 commits intomasterfrom
Its-Just-Nans-patch-1

Conversation

@Its-Just-Nans
Copy link
Copy Markdown
Member

@Its-Just-Nans Its-Just-Nans commented Mar 9, 2026

fix: #715

Also fix the zip64 central directory creation and add a test

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the handling of Zip64 extended information in central directory headers. It introduces a mechanism to explicitly mark files as 'large', ensuring that the necessary Zip64 fields are always written for them, regardless of their specific size values. This change improves the robustness and correctness of ZIP archive generation, particularly for files that might be logically large but have zero or small reported sizes under certain conditions.

Highlights

  • Zip64 Extended Information Logic: The central_header function in Zip64ExtendedInformation now accepts an is_large_file boolean parameter. This parameter explicitly signals whether a file should be treated as large, ensuring that Zip64 size fields are included even if the uncompressed_size or compressed_size are zero or below the ZIP64_BYTES_THR threshold.
  • Integration with File Writing: The write_central_directory_header function in write.rs has been updated to pass the file.large_file flag to the Zip64ExtendedInformation::central_header function, correctly propagating the large file status.
Changelog
  • src/extra_fields/zip64_extended_information.rs
    • Modified the central_header function signature to include an is_large_file parameter.
    • Adjusted the conditional logic for including uncompressed and compressed sizes in the Zip64 extended information based on the new is_large_file parameter.
  • src/write.rs
    • Updated the call to Zip64ExtendedInformation::central_header to pass the file.large_file boolean argument.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@amazon-q-developer amazon-q-developer bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR correctly adds the missing is_large_file parameter to Zip64ExtendedInformation::central_header() and updates the call site. The central_header function was already checking is_large_file in its logic (lines 80, 86) but the parameter wasn't being passed from the caller, which would have caused the condition to always be false. This fix ensures that files explicitly marked with large_file: true will consistently use ZIP64 extra fields in both local and central directory headers, even when file sizes are below the 4GiB threshold.

Note: The PR title should follow Conventional Commits format (e.g., "fix: add missing is_large_file parameter to central_header").


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment thread src/write.rs Outdated
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces an is_large_file boolean parameter to the Zip64ExtendedInformation::central_header function. This parameter is now passed from the write_central_directory_header function and is used to explicitly include uncompressed and compressed sizes in the ZIP64 extended information block if a file is designated as large, even if its size does not exceed the ZIP64_BYTES_THR threshold.

Comment thread src/types.rs Fixed
Comment thread src/types.rs Fixed
Comment thread src/types.rs Fixed
Comment thread src/types.rs Fixed
Comment thread src/types.rs Fixed
Comment thread src/types.rs Fixed
@Its-Just-Nans
Copy link
Copy Markdown
Member Author

Its-Just-Nans commented Mar 9, 2026

@Pr0methean I think we should merge this

Or wait for a test

Or add the test later

@Its-Just-Nans Its-Just-Nans self-assigned this Mar 9, 2026
Comment thread src/write.rs Outdated
@Its-Just-Nans
Copy link
Copy Markdown
Member Author

I think https://github.com/zip-rs/zip2/pull/265/changes is not correct and
e86d376 not the best

Copy link
Copy Markdown
Member

@Pr0methean Pr0methean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please describe whatever issues this fixes in the title, link them in the description, and add a category to the title?

Comment thread src/extra_fields/zip64_extended_information.rs Outdated
@Its-Just-Nans Its-Just-Nans changed the title Update zip64_extended_information.rs fix: zip64 extended information Mar 11, 2026
@Pr0methean Pr0methean changed the title fix: zip64 extended information fix: Malformed ZIP64 file output (#715) Mar 11, 2026
Copy link
Copy Markdown
Member

@Pr0methean Pr0methean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of nitpicks.

Comment thread tests/zip64_large.rs Outdated
Comment thread tests/zip64_large.rs Outdated
@Its-Just-Nans Its-Just-Nans enabled auto-merge March 16, 2026 04:44
@Its-Just-Nans Its-Just-Nans dismissed Pr0methean’s stale review March 16, 2026 04:44

dimissing the review (fixed) to merge queue

@Its-Just-Nans Its-Just-Nans added this pull request to the merge queue Mar 16, 2026
Merged via the queue into master with commit 859dc16 Mar 16, 2026
130 checks passed
@Its-Just-Nans Its-Just-Nans deleted the Its-Just-Nans-patch-1 branch March 16, 2026 07:45
This was referenced Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in 8.2.0: Deflated + large_file(true) can produce ZIPs that fail to extract

3 participants