Commit e146591
stream: fix decoded fromList chunk boundary check
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)`.
PR-URL: #61884
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>1 parent 5a9874a commit e146591Copy full SHA for e146591
2 files changed
+17-1Lines changed: 17 additions & 1 deletion
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- lib/internal/streams
- test/parallel
Expand file treeCollapse file tree
Open diff view settings
Collapse file
lib/internal/streams/readable.js
Copy file name to clipboardExpand all lines: lib/internal/streams/readable.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1664 | 1664 | |
1665 | 1665 | |
1666 | 1666 | |
1667 | | - |
| 1667 | + |
1668 | 1668 | |
1669 | 1669 | |
1670 | 1670 | |
|
Collapse file
test/parallel/test-stream2-read-correct-num-bytes-in-utf8.js
Copy file name to clipboard+16Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
0 commit comments