stream: fix decoded fromList chunk boundary check#61884
Open
watson wants to merge 2 commits intonodejs:mainfrom
Open
stream: fix decoded fromList chunk boundary check#61884watson wants to merge 2 commits intonodejs:mainfrom
watson wants to merge 2 commits intonodejs:mainfrom
Conversation
Collaborator
|
Review requested:
|
Correct `fromList()` in decoded string mode to compare `n` against the current chunk length, not the buffer array length. This prevents over-consuming chunks, which can corrupt readable state and crash with `TypeError` when mixing `setEncoding()` and `read(n)`.
8a962b7 to
5ef134f
Compare
ronag
approved these changes
Feb 19, 2026
BridgeAR
approved these changes
Feb 19, 2026
Collaborator
IlyasShabi
approved these changes
Feb 19, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #61884 +/- ##
==========================================
- Coverage 91.81% 89.73% -2.08%
==========================================
Files 338 675 +337
Lines 140073 204855 +64782
Branches 22081 39372 +17291
==========================================
+ Hits 128605 183829 +55224
- Misses 11242 13287 +2045
- Partials 226 7739 +7513
🚀 New features to boost your workflow:
|
gurgunday
approved these changes
Feb 19, 2026
lpinca
approved these changes
Feb 19, 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.
Correct
fromList()in decoded string mode to comparenagainst the current chunk length, not the buffer array length.This prevents over-consuming chunks, which can corrupt readable state and crash with
TypeErrorwhen mixingsetEncoding()andread(n).I reproduced this in all non-EoL release lines.
For reference, here's the script I used to make
read()throw (usually it throws almost instantly, but a few times it can take a little while):And here's the output: