Skip to content
Commit Detail

Commit 39b509a

Author
James M Snell <jsnell@cloudflare.com> 2026-03-18 16:53:00 -0700
Parents
b80d21d
Tree
26d5235
Fix OKP public JWK import to use raw public key

The previous clearBuffers() fix (bea11e5bd) 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.

Files changed

2 files changed~2 modified