Commit 4438550
buffer: ignore negative allocation lengths
Treat negative length arguments to `Buffer()`/`allocUnsafe()`
as if they were zero so the allocation does not affect the
pool’s offset.
Fixes: #7047
PR-URL: #7051
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>1 parent 29200ed commit 4438550Copy full SHA for 4438550
File tree
Expand file treeCollapse file tree
2 files changed
+13
-2
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
2 files changed
+13
-2
lines changedOpen diff view settings
Collapse file
+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
199 | 199 | |
200 | 200 | |
201 | 201 | |
202 | | - |
203 | | - |
| 202 | + |
| 203 | + |
204 | 204 | |
205 | 205 | |
206 | 206 | |
|
Collapse file
test/parallel/test-buffer.js
Copy file name to clipboardExpand all lines: test/parallel/test-buffer.js+11Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1465 | 1465 | |
1466 | 1466 | |
1467 | 1467 | |
| 1468 | + |
| 1469 | + |
| 1470 | + |
| 1471 | + |
| 1472 | + |
| 1473 | + |
| 1474 | + |
| 1475 | + |
| 1476 | + |
| 1477 | + |
| 1478 | + |
0 commit comments