[v22.x backport] test_runner: convert to uint during deserialization - #65939
Open
positivef wants to merge 1 commit into
Open
[v22.x backport] test_runner: convert to uint during deserialization#65939positivef wants to merge 1 commit into
positivef wants to merge 1 commit into
Conversation
Signed-off-by: Aviv Keller <me@aviv.sh> PR-URL: nodejs#64706 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Collaborator
|
Review requested:
|
Contributor
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
meixg
approved these changes
Sep 10, 2026
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.
Backport of #64706 to
v22.x-staging. Backport was requested in #65934.What is included
Only the
lib/internal/test_runner/runner.jshunk. It cherry-picks cleanly ontov22.x-staging(offset -135 lines) and the diff here is identical to the original hunk.What is NOT included, and why
The original commit also added a case to
test/parallel/test-runner-v8-deserializer.mjs:That test would hang on
v22.x. It depends on #62704 (debe2ed2efd3, "test_runner: avoid hanging on incomplete v8 frames"), which is not on this line. Onv22.x,#drainRawBufferis still:so a frame whose declared length exceeds the buffered bytes is never consumed and the loop never ends. Measured on v22.19.0 against the shipped
FileTest(--expose-internals, feed one chunk toparseMessage, thendrain()):ff 0f 7f ff ff ff(oversized, positive)ff 0f 00 01 00 00(truncated)ff 0f 80 00 00 00(the case this fix is about)Unable to deserialize cloned data …With
>>> 0applied, the third row joins the first two, so importing the upstream test as-is would wedge the suite on this line.For the same reason #62704 is not a trivial follow-up: it does not apply cleanly to
v22.x-staging— bothrunner.jsand the test file conflict. I am happy to prepare that backport as a separate PR if you would rather the test came along with the fix; please tell me which ordering you prefer.Why the fix is still worth having on v22.x without its test
The real-world trigger is not synthetic.
#processRawBufferadvancesbufferHeadpast a consumed message and then reads the next four bytes as a length without re-checking for theff 0fheader, so any non-ASCII byte a test writes to stdout immediately after a report message is read as the top byte of that length. Every UTF-8 lead/continuation byte is>= 0x80, which makesfullMessageSizenegative and defeats theif (this.#rawBufferSize < fullMessageSize) breakguard.Unlike the synthetic case in the table, that path is genuinely repaired by
>>> 0on this line: the oversized length now makes the loopbreak, and because those bytes do not start withff 0fthey are subsequently emitted through the non-serialized stdout path instead of being handed toDefaultDeserializer.A deterministic reproduction (no load, no concurrency — one
write(), and an env var flips it between failing and passing) and the three symptoms observed on v22.19.0 — including one where a whole test file's results disappear with no failure, no summary and no error text — are in #65934.Checklist
main2026-07-26 and shipped in v26.7.0 on 2026-08-05, so it has been in Current well beyond the two-week requirement for LTS lines.make -j4 test: not run. I have no Node build environment on this machine, so I have only verified that the hunk applies cleanly and matches the original. Please treat CI as the source of truth.main, and noBackport-PR-URLentry was added by hand.