fix: zip64 creation of exactly 4GB without large file should crash#839
fix: zip64 creation of exactly 4GB without large file should crash#839Its-Just-Nans wants to merge 14 commits into
Conversation
There was a problem hiding this comment.
The fix correctly addresses the ZIP64 boundary condition bug. The comparison change from > to >= at line 2441 properly handles files of exactly 4GB, ensuring the ZIP64 extended information extra field is included as required by the ZIP specification. The added error handling and test coverage strengthen the implementation.
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 improves error handling when updating local file headers and adjusts the Zip64 threshold comparison from > to >= to correctly handle files at the 4GB limit. It also includes a new test case for 4GB files. Feedback suggests that the Zip64 threshold change should be applied consistently across other modules, such as EOCD64 and central directory headers, to avoid potential corruption. Additionally, the error handling logic in src/write.rs should be refined to ensure the writer's state is correctly reset and errors are not swallowed if a seek operation fails.
|
I'm not a big fan of introducing Also note that with my ongoing extra field rewrite, some of this code will be rewritten (but I still prefer to have a correct base) |
Okay I think I have fixed the "panic on drop" error that was forcing me to use a new variable |
While doing the extra field rewrite I found TWO little bug with zip64
u32::MAXbut (u32::MAX -1), and we need to check for>=instead of>. linked with this line which looks wrongzip2/tests/append_near_4gb.rs
Lines 35 to 36 in 572df42
write_central_and_footeris not handling zip64Bug 1
If we create a file of exactly 4GB, the header does not contains a zip 64 extended information extra field
but it should
this is due to the fact that our comparaison is
>and not>=Bug 2
On debug, we can have panic on drop because of a
debug_asset!. Which is not great