fix: rewrite extra fields#879
Conversation
There was a problem hiding this comment.
This PR successfully refactors extra fields from raw byte vectors to structured types, improving type safety and maintainability. The changes correctly preserve functionality while making the codebase more robust. The refactoring includes:
- Replacing
#[repr(packed, C)]with proper typed structs inAexEncryption - Improving
Zip64ExtendedInformation::parseto handleu32/u64conversions correctly - Adding write methods for
UnicodeExtraField - Creating a new structured
ExtraFieldenum
No blocking issues found. The code is ready for merge once the draft status is resolved and the mentioned tests are fixed.
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.
There was a problem hiding this comment.
Code Review
This pull request refactors the handling of ZIP extra fields by replacing raw byte arrays with a structured ExtraFields type and ExtraField enum, updating both the reader and writer implementations to parse, apply, and serialize these fields directly. The review feedback highlights several critical areas for improvement: a potential infinite loop/DoS vulnerability in stream reading on Io errors, unnecessary heap allocations when skipping bytes, robustness issues when parsing invalid UTF-8 in Unicode comments or paths, and multiple uses of unstable let-chains that could break MSRV compatibility. Additionally, a breaking change was identified in ZipFile::extra_data where it returns empty vectors instead of None, and some commented-out code needs to be cleaned up.
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.
|
I've started to review this version of the PR, and will likely be able to finish in the next few days. |
Pr0methean
left a comment
There was a problem hiding this comment.
This is a partial review; it covers all except src/write.rs and tests/*.rs.
Second part of the extra fields rewrite
Big change is that
ExtraFieldsare now structs, not randomVec<u8>