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

Fix to 2e672f33 decompress_peek_gz change. #1646

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

jkbonfield
Copy link
Contributor

The "zs.total_out < destsize" should have been "zs.avail_out" to be more robust to total_out being reset by inflateReset. However looking again neither the avail_in or avail_out checks are necessary, as once we hit the end of either input or output buffer the next cycle triggers ret == Z_BUF_ERROR and we drop out as normal.

Thanks to John Marshall for the spot.

See #1643

@daviesrob
Copy link
Member

Isn't the same problem still present in the main while loop?
I.e.:

    while (zs.total_out < destsize) {

would be better done as:

    while (zs.avail_out > 0) {

@daviesrob daviesrob self-assigned this Jul 18, 2023
The "zs.total_out < destsize" should have been "zs.avail_out" to be
more robust to total_out being reset by inflateReset.  However looking
again neither the avail_in or avail_out checks are necessary, as once
we hit the end of either input or output buffer the next cycle
triggers ret == Z_BUF_ERROR and we drop out as normal.

Thanks to John Marshall for the spot.
@daviesrob daviesrob merged commit 5dc826f into samtools:develop Jul 18, 2023
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.

2 participants