Skip to content
GitHub no longer supports this web browser. Learn more about the browsers we support.
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

Add testcase for case where both input and output buffers are full. #68

Merged
merged 1 commit into from Jan 31, 2020

Conversation

@golddranks
Copy link
Contributor

golddranks commented Jan 31, 2020

This commit adds a testcase that fails because of an apparent bug in miniz_oxide. The bug happens when it just so happens that both input buffer becomes empty and output buffer becomes full during the same call to the inflate::core::decompress function. In that case, I think that most users of the library expect to get HasMoreOutput status, urging them to read the output value before it gets overwritten by another decompress call.

However, in some (but only in some) cases, NeedsMoreInput status is returned. If the user naively pattern-matches to the status and calls again with more input, data loss occurs. Therefore, when the output buffer is full, HasMoreOutput should always be prioritized over NeedsMoreInput.

I don't still know enough about the insides of this library to suggest a fix in the same PR. However, at least I was able to reduce the bug into a relatively simple case.

@golddranks golddranks requested a review from oyvindln Jan 31, 2020
@oyvindln

This comment has been minimized.

Copy link
Collaborator

oyvindln commented Jan 31, 2020

Thanks, will have to look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.