Migrate zlib from jsg::BufferSource to jsg::JsArrayBufferView#6356
Merged
Migrate zlib from jsg::BufferSource to jsg::JsArrayBufferView#6356
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Merging this PR will not alter performance
Comparing Footnotes
|
anonrig
approved these changes
Mar 18, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6356 +/- ##
=======================================
Coverage 70.68% 70.68%
=======================================
Files 420 420
Lines 113025 113016 -9
Branches 18534 18533 -1
=======================================
- Hits 79893 79887 -6
Misses 22086 22086
+ Partials 11046 11043 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The previous clearBuffers() fix (bea11e5) placed explicit calls after updateWriteResult(). If updateWriteResult() throws (e.g. when the writeState buffer passed to initialize() has fewer than 2 uint32 elements), the exception unwinds the stack before clearBuffers() is reached, leaving z_stream.next_out pointing into the output buffer's BackingStore. Once GC frees that memory, a subsequent params() call triggers deflateParams() -> flush_pending() writing to freed memory. Replace the three explicit clearBuffers() calls with a single KJ_DEFER at the top of writeStream(). This guarantees the pointers are cleared on every scope exit, including exception unwinding.
d45ddc3 to
39b509a
Compare
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.
jsg::BufferSourceis too heavyweight for the simple uses in zlib.