Commit 2bb1475
fs: don't throw in read if buffer too big
If the resulting buffer.toString() call in fs.read throws, catch the
error and pass it back in the callback.
This issue only presents itself when fs.read is called using the legacy
string interface:
fs.read(fd, length, position, encoding, callback)
PR-URL: #3503
Reviewed-By: Trevor Norris <trev.norris@gmail.com>1 parent 9d8d752 commit 2bb1475Copy full SHA for 2bb1475
File tree
Expand file treeCollapse file tree
2 files changed
+74
-3
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
2 files changed
+74
-3
lines changedOpen diff view settings
Collapse file
+16-3Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
599 | 599 | |
600 | 600 | |
601 | 601 | |
| 602 | + |
602 | 603 | |
603 | | - |
604 | | - |
605 | | - |
| 604 | + |
| 605 | + |
| 606 | + |
| 607 | + |
| 608 | + |
606 | 609 | |
607 | 610 | |
608 | 611 | |
| ||
617 | 620 | |
618 | 621 | |
619 | 622 | |
| 623 | + |
| 624 | + |
| 625 | + |
| 626 | + |
| 627 | + |
| 628 | + |
| 629 | + |
| 630 | + |
| 631 | + |
| 632 | + |
620 | 633 | |
621 | 634 | |
622 | 635 | |
|
Collapse file
test/parallel/test-fs-read-buffer-tostring-fail.js
Copy file name to clipboard+58Lines changed: 58 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 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
0 commit comments