Skip to content

Update Inflater dynamic header reader to support partial reads#249

Merged
piksel merged 8 commits into
icsharpcode:masterfrom
piksel:inflate-dynheader
Jul 20, 2018
Merged

Update Inflater dynamic header reader to support partial reads#249
piksel merged 8 commits into
icsharpcode:masterfrom
piksel:inflate-dynheader

Conversation

@piksel

@piksel piksel commented Jul 15, 2018

Copy link
Copy Markdown
Member

PR #233 got rid of the state machine for reading dynamic headers, this means that it may fail to read the header when using small buffers or with unlucky alignment.
This PR reintroduces a state machine that fully supports partial reading and continuing when more data is available.
It also handles invalid header data/state correctly and throws useful exceptions on bad data.

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

piksel added 5 commits July 15, 2018 21:41
Returning true here just puts us in an infinite loop, not sure what was supposed to happen?

Fixes icsharpcode#229.
 * Permits using ArraySegment instead of copying the source array
 * Formatting
* Uses Enumerable state machine
* Skips two array copies by using ArraySegment
* Throws usable exceptions when invalid values are being read
@piksel piksel added zip Related to ZIP file format in progress labels Jul 15, 2018
@piksel piksel added this to the 1.0 milestone Jul 18, 2018
@piksel piksel added ready PR ready for merging when appropriate and removed in progress labels Jul 19, 2018
@piksel piksel merged commit 796b5be into icsharpcode:master Jul 20, 2018
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

Development

Successfully merging this pull request may close these issues.

1 participant