zlib: avoid an extra empty zstd frame - #66161
Open
marcopiraccini wants to merge 1 commit into
Open
marcopiraccini wants to merge 1 commit into
marcopiraccini wants to merge 1 commit into
Conversation
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
marcopiraccini
marked this pull request as ready for review
September 20, 2026 15:22
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66161 +/- ##
==========================================
+ Coverage 90.27% 90.28% +0.01%
==========================================
Files 790 790
Lines 271981 271988 +7
Branches 51913 51920 +7
==========================================
+ Hits 245531 245568 +37
+ Misses 16945 16912 -33
- Partials 9505 9508 +3
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
createZstdCompress()could append an empty frame whenend()was called while writes were still queued. The last queued chunk could finish the frame, then the stream's final flush sentZSTD_e_endagain with no input.Track when the frame has ended and skip empty calls until more input arrives. This avoids the extra frame while still allowing a later write to start a new one.
Added
test/parallel/test-zlib-zstd-compress-single-frame.jsto cover queued writes, explicit frame endings, an empty flush, an empty stream, and a later frame.Fixes: #66078
Note
PR #66091 proposed the same C++ fix but was closed without merging. This PR expands the regression coverage to include an empty flush after a completed frame, an empty stream, and a deliberate second frame, alongside queued writes and an explicit end flush. The empty flush completes before
end()so the test exercisesZSTD_e_flushseparately.