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

Remove bad GZipException and don't loop forever on 0 reads #372

Merged
merged 1 commit into from
Aug 9, 2019

Conversation

piksel
Copy link
Member

@piksel piksel commented Aug 8, 2019

PR #225 introduced a new throw that did not test the right values. The case of stream EOF is handled when attempting to fill the input buffer and inf.RemainingInput should not be used for this. Instead, the reason for the test getting stuck is that it attempts to read 0 bytes from the stream. Since the loop tries to read data until it can read at least one byte, it's forever stuck (since attempting to read 0 bytes never returns more than 0 bytes read).

The use case for supplying 0 as count is probably slim, but at least now we're not stuck in an infinite loop.

Corr for #225
Fixes #360

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
Copy link
Member Author

piksel commented Aug 8, 2019

@Numpsy Any thoughts? I've been at this for some time now, but I might have missed something crucial.

@Numpsy
Copy link
Contributor

Numpsy commented Aug 8, 2019

I'm not sure if there are any other situations where the internal read would return 0 rather than throwing, hopefully not.

@piksel piksel merged commit 805dd79 into master Aug 9, 2019
@piksel piksel deleted the corr-pr225 branch August 21, 2019 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gzip decompress Unexpected EOF with small buffer + fix
2 participants