Skip to content

Reject truncated gzip streams instead of returning partial success - #652

Merged
bsergean merged 1 commit into
masterfrom
fix/gzip-stream-validation
Nov 17, 2026
Merged

bsergean merged 1 commit into
masterfrom
fix/gzip-stream-validation

Conversation

@bsergean

Copy link
Copy Markdown
Collaborator

A truncated gzip body can currently return success with partial or empty output because decoding stops as soon as the output buffer is not full. This also accepts input missing the gzip checksum/trailer.

Require Z_STREAM_END before returning success and reject zlib error/no-progress results. Preserve the existing append-to-output behavior for valid streams.

Validation: exhaustively truncate the compressed representations of empty, small and 32 KiB payloads at every byte boundary; also check complete streams, binary content and a corrupt checksum. Master fails 109 assertions; the fix passes all 121. These tests are in memory, with no sleeps or network requests, and finish in milliseconds. Combined plain-socket suite: 30/30 passed; targeted ASan/UBSan checks passed. Strict C++11 production build, formatting and diff checks passed.

@bsergean
bsergean merged commit 62bf374 into master Nov 17, 2026
13 checks passed
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