fix(streamingUnzip): avoid detection of incorrect ZIP signature#275
Open
cyfung1031 wants to merge 1 commit into
Open
fix(streamingUnzip): avoid detection of incorrect ZIP signature#275cyfung1031 wants to merge 1 commit into
cyfung1031 wants to merge 1 commit into
Conversation
Author
|
because #235 is due to the streaming Unzip mixed up the ZIP signatures of the stored zip files and the one it is working on. |
Author
because #208 is due to the wrong detection of EOL due to the ZIP signature detection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(Although the code is generated by AI but since 101arrowz do not like AI paragraphs so I write the following)
This is to solve the current design limit of streaming Unzip - causing issue #243.
When it scan the ZIP signatures like 0x8074B50, 0x4034B50, 0x2014B50, etc, it will believe this is end of file.
but this is incorrect since the compressed file might also contain such bytes by chance.
now the field "b" is added to represent "compressed bytes flushed so far for the current data-descriptor entry"
Then using
this.b + candidateEndOffsetto check whether the compression data matches descriptor, rather than just trusting the ZIP signature bytes.( A real boundary is always preceded by a data descriptor whose csize field must equal the bytes consumed so far. )
btw
z = oc == -2 && 8is for zip64 data descriptors detection. So that it can check with the 64-bit size as well.if you still don't like AI coding, just take it as a reference and do it yourself.
The coding isn't changed too much and you can read.
In addition