deno
0edb72e6 - fix(ext/node): restore Node binding signature for zlib write/writeSync (#35238)

Commit
158 days ago
fix(ext/node): restore Node binding signature for zlib write/writeSync (#35238) PR #35043 fixed a use-after-free in the zlib, brotli and zstd bindings by moving the result buffer (the stream's `_writeState`, where the post-write `avail_out`/`avail_in` pair is stored) from a pointer cached at init time to a per-write argument, so that detaching the buffer can no longer produce a dangling write. A side effect was that the low-level `write`/`writeSync` handle methods gained a required trailing argument, breaking their Node binding signature. Some npm packages call those methods directly without it (notably pngjs's synchronous inflate, used by png-to-ico and others), so on 2.8.3 they started throwing `expected typed ArrayBufferView`. This wraps the native handle so `write`/`writeSync` inject the stream's own `_writeState` when an external caller omits the trailing buffer, restoring the Node-compatible arity. The native ops are unchanged and still take the buffer per write and bounds check it, so a detached buffer remains a harmless no-op and the original security fix is fully preserved. Closes #35185
Author
Parents
Loading