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

fix(zip): handle iterating updated entries in ZipInputStream #642

Merged
merged 5 commits into from
Aug 16, 2022

Conversation

piksel
Copy link
Member

@piksel piksel commented Jun 7, 2021

Currently ZipInputStream expects all archive entries to immediately follow the previous one. This is normally the case for archives created in one go, but necessarily true when they have been updated.
This PR allows ZipInputStream to skip any padding between entries and consequently read "direct-updated" archives.

Fixes #639

Curiously, 7-zip does not seem to handle these files either and just show all entries found before the first "padded" one. And of course, when updating it uses the equivalent of ZipFiles FileUpdateMode.Safe to avoid the issue.

@piksel piksel added the zip Related to ZIP file format label Jun 7, 2021
@codecov
Copy link

codecov bot commented Jun 8, 2021

Codecov Report

Merging #642 (77dbae4) into master (bdec777) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #642      +/-   ##
==========================================
+ Coverage   74.54%   74.60%   +0.05%     
==========================================
  Files          72       72              
  Lines        8450     8457       +7     
==========================================
+ Hits         6299     6309      +10     
+ Misses       2151     2148       -3     
Impacted Files Coverage Δ
src/ICSharpCode.SharpZipLib/Zip/ZipInputStream.cs 82.46% <100.00%> (+2.07%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@piksel piksel linked an issue Oct 9, 2021 that may be closed by this pull request
@piksel piksel added this to the v1.4 milestone Oct 10, 2021
@piksel piksel self-assigned this Aug 14, 2022
@piksel piksel added the ready PR ready for merging when appropriate label Aug 14, 2022
@piksel piksel changed the title Handle updated zip entries when iterating using ZipInputStream fix(zip): handle iterating updated entries in ZipInputStream Aug 16, 2022
@piksel piksel merged commit 519ed73 into master Aug 16, 2022
@piksel piksel deleted the feat/zis-updated-iter branch August 16, 2022 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready PR ready for merging when appropriate zip Related to ZIP file format
Projects
None yet
1 participant