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

Handle inflate returning Z_OK at end of stream #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johan13
Copy link

@johan13 johan13 commented Sep 19, 2024

The inflate function may return Z_OK rather than Z_STREAM_END when the last bytes of the stream are inflated. In this case inflate returns Z_STREAM_END on the next call. However in this situation we will already have reset avail_out for the next line and the d_stream.avail_out == 0 condition will be false.

The zlib documentation is not very clear about this, but I have verified that it still behaves this way in version 1.3.1.

The inflate function may return Z_OK rather than Z_STREAM_END when the last
bytes of the stream are inflated. In this case inflate returns Z_STREAM_END on
the next call. However in this situation we will already have reset avail_out
for the next line and the "d_stream.avail_out == 0" condition will be false.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant