Skip to content

fix: ignore zip info extra field on failure#868

Open
Its-Just-Nans wants to merge 11 commits into
masterfrom
ignore-extra-field-on-failure
Open

fix: ignore zip info extra field on failure#868
Its-Just-Nans wants to merge 11 commits into
masterfrom
ignore-extra-field-on-failure

Conversation

@Its-Just-Nans

Copy link
Copy Markdown
Member

fix #867

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The PR correctly implements the fix for issue #867 by changing Unicode extra field handling to gracefully ignore invalid CRC32 values instead of throwing errors. This aligns with the ZIP specification (APPNOTE 4.6.8 and 4.6.9) which states that if the CRC check fails, the UTF-8 extra field SHOULD be ignored and the File Name field in the header SHOULD be used instead.

The implementation properly:

  • Validates CRC32 before applying Unicode fields
  • Falls back to original fields when validation fails
  • Adds comprehensive test coverage for both Unicode path and comment scenarios

The changes are minimal and focused on the specific issue, maintaining backward compatibility while improving robustness.


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/extra_fields/zipinfo_utf8.rs Outdated

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces CRC32 validation for Unicode extra fields (path and comment) in ZIP archives, ensuring that UTF-8 fields are ignored if their CRC32 does not match the ASCII fields. It also adds corresponding tests. The review feedback suggests simplifying the CRC32 validation logic to return the comparison directly, and using into_vec() instead of to_vec() to avoid unnecessary heap allocations when updating the file comment and name. Additionally, a defensive UTF-8 validity check is recommended for the filename byte string.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/extra_fields/zipinfo_utf8.rs
Comment thread src/read/mod.rs
Comment thread src/read/mod.rs
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.

CRC32 checksum failed on Unicode extra field on zip file containing non-unicode filenames

1 participant