Commit 5ef134f
committed
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)`.1 parent d5279e5 commit 5ef134f
File tree
2 files changed
+16
-1
lines changed- lib/internal/streams
- test/parallel
2 files changed
+16
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1669 | 1669 | | |
1670 | 1670 | | |
1671 | 1671 | | |
1672 | | - | |
| 1672 | + | |
1673 | 1673 | | |
1674 | 1674 | | |
1675 | 1675 | | |
| |||
Lines changed: 15 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 | + | |
0 commit comments