| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Review requested:
|
Sorry, something went wrong.
There was a problem hiding this comment.
This was a test for the behaviour reported in #12152, where calling .write('string', 'buffer') on a StreamBase-backed stream would crash the process. I don't believe there's any way to hit this if this change lands, but not confidently enough to revert back to a CHECK (cf. #12753) without a second opinion – maybe Team Stream has an insight?
(cc @addaleax)
Sorry, something went wrong.
There was a problem hiding this comment.
I'm fairly confident that this can't now be hit (
Lines 67 to 73 in 843dc5f
Sorry, something went wrong.
| @@ -31,7 +31,7 @@ function test(autoDestroy) { | |||
| { | |||
| const w = new Writable({ | |||
| autoDestroy, | |||
| _write() {} | |||
| write() {} | |||
There was a problem hiding this comment.
These tests were using the wrong constructor option name for setting the _write implementation. It doesn't matter if the error tests fail as expected, but it does make the assertion message less clear if an error test doesn't fail, as it instead complains about a missing _write implementation rather than reporting the missing expected error.
Sorry, something went wrong.
Codecov Report❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
@@ Coverage Diff @@
## main #63062 +/- ##
=======================================
Coverage 90.05% 90.06%
=======================================
Files 714 714
Lines 225247 225248 +1
Branches 42578 42580 +2
=======================================
+ Hits 202842 202860 +18
+ Misses 14181 14180 -1
+ Partials 8224 8208 -16
... and 25 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
Signed-off-by: Renegade334 <contact.9a5d6388@renegade334.me.uk>
Signed-off-by: Renegade334 <contact.9a5d6388@renegade334.me.uk>
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
Commit Queue failed- Loading data for nodejs/node/pull/63062 ✔ Done loading data for nodejs/node/pull/63062 ----------------------------------- PR info ------------------------------------ Title stream: disallow writing string chunk with 'buffer' encoding (#63062) Author René <contact.9a5d6388@renegade334.me.uk> (@Renegade334) Branch Renegade334:writable-invalid-buffer-encoding -> nodejs:main Labels stream, baking-for-lts, needs-ci, commit-queue-squash Commits 2 - stream: disallow writing string chunk with 'buffer' encoding - stream: restore buffer CHECK assertion in StreamBase::WriteBuffer Committers 1 - Renegade334 <contact.9a5d6388@renegade334.me.uk> PR-URL: https://github.com/nodejs/node/pull/63062 Refs: https://github.com/nodejs/node/pull/33075 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/63062 Refs: https://github.com/nodejs/node/pull/33075 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> -------------------------------------------------------------------------------- ℹ This PR was created on Fri, 01 May 2026 13:44:15 GMT ✔ Approvals: 3 ✔ - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/63062#pullrequestreview-4212353853 ✔ - Ethan Arrowood (@Ethan-Arrowood): https://github.com/nodejs/node/pull/63062#pullrequestreview-4299586870 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/63062#pullrequestreview-4304020488 ✔ Last GitHub CI successful ✘ No Jenkins CI runs detected -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/26031934637 |
Sorry, something went wrong.
Sorry, something went wrong.
Signed-off-by: Renegade334 <contact.9a5d6388@renegade334.me.uk> PR-URL: nodejs#63062 Refs: nodejs#33075 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
| Back | FazBrowse Home | New Git URL |
In non-object mode, Writable.prototype.write() validates the encoding as either 'buffer' or a valid string encoding.
Under default conditions, passing the encoding 'buffer' in combination with a string chunk results indirectly in an ERR_UNKNOWN_ENCODING error, because those are passed to Buffer.from() which considers the 'buffer' encoding to be invalid.
However, when decodeStrings is disabled, this indirect validation does not occur, and the string chunk is sent to the write() implementation with the encoding 'buffer', which is obviously nonsense.
semver... something?
Refs: #33075