Commit b3ec13d
authored
fs: adjust
This prohibits invalid values (< -1 and non-integers) and
allows `filehandle.read()` to handle position up to `2n ** 63n - 1n`
PR-URL: #42835
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>position validation in reading methods1 parent 7f0e36a commit b3ec13dCopy full SHA for b3ec13d
File tree
Expand file treeCollapse file tree
7 files changed
+133
-31
lines changedOpen diff view settings
Filter options
- doc/api
- lib
- internal/fs
- test/parallel
Expand file treeCollapse file tree
7 files changed
+133
-31
lines changedOpen diff view settings
Collapse file
+28-14Lines changed: 28 additions & 14 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
369 | 369 | |
370 | 370 | |
371 | 371 | |
| 372 | + |
| 373 | + |
| 374 | + |
| 375 | + |
372 | 376 | |
373 | 377 | |
374 | 378 | |
375 | 379 | |
376 | 380 | |
377 | 381 | |
378 | | - |
379 | | - |
380 | | - |
381 | | - |
| 382 | + |
| 383 | + |
| 384 | + |
| 385 | + |
382 | 386 | |
383 | 387 | |
384 | 388 | |
| ||
395 | 399 | |
396 | 400 | |
397 | 401 | |
| 402 | + |
| 403 | + |
| 404 | + |
| 405 | + |
398 | 406 | |
399 | 407 | |
400 | 408 | |
| ||
404 | 412 | |
405 | 413 | |
406 | 414 | |
407 | | - |
408 | | - |
409 | | - |
410 | | - |
| 415 | + |
| 416 | + |
| 417 | + |
| 418 | + |
| 419 | + |
411 | 420 | |
412 | 421 | |
413 | 422 | |
| ||
424 | 433 | |
425 | 434 | |
426 | 435 | |
| 436 | + |
| 437 | + |
| 438 | + |
| 439 | + |
427 | 440 | |
428 | 441 | |
429 | 442 | |
| ||
433 | 446 | |
434 | 447 | |
435 | 448 | |
436 | | - |
437 | | - |
438 | | - |
439 | | - |
| 449 | + |
| 450 | + |
| 451 | + |
| 452 | + |
| 453 | + |
440 | 454 | |
441 | 455 | |
442 | 456 | |
| ||
3514 | 3528 | |
3515 | 3529 | |
3516 | 3530 | |
3517 | | - |
3518 | | - |
| 3531 | + |
| 3532 | + |
3519 | 3533 | |
3520 | 3534 | |
3521 | 3535 | |
|
Collapse file
+8-6Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
656 | 656 | |
657 | 657 | |
658 | 658 | |
659 | | - |
| 659 | + |
660 | 660 | |
661 | | - |
662 | | - |
| 661 | + |
| 662 | + |
| 663 | + |
663 | 664 | |
664 | 665 | |
665 | 666 | |
| ||
724 | 725 | |
725 | 726 | |
726 | 727 | |
727 | | - |
| 728 | + |
728 | 729 | |
729 | | - |
730 | | - |
| 730 | + |
| 731 | + |
| 732 | + |
731 | 733 | |
732 | 734 | |
733 | 735 | |
|
Collapse file
lib/internal/fs/promises.js
Copy file name to clipboardExpand all lines: lib/internal/fs/promises.js+5-2Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
6 | 6 | |
7 | 7 | |
8 | 8 | |
9 | | - |
10 | 9 | |
11 | 10 | |
12 | 11 | |
| ||
67 | 66 | |
68 | 67 | |
69 | 68 | |
| 69 | + |
70 | 70 | |
71 | 71 | |
72 | 72 | |
| ||
636 | 636 | |
637 | 637 | |
638 | 638 | |
639 | | - |
| 639 | + |
640 | 640 | |
| 641 | + |
| 642 | + |
| 643 | + |
641 | 644 | |
642 | 645 | |
643 | 646 | |
|
Collapse file
+5-4Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
916 | 916 | |
917 | 917 | |
918 | 918 | |
919 | | - |
| 919 | + |
920 | 920 | |
921 | | - |
| 921 | + |
922 | 922 | |
923 | | - |
| 923 | + |
| 924 | + |
924 | 925 | |
925 | | - |
| 926 | + |
926 | 927 | |
927 | 928 | |
928 | 929 | |
|
Collapse file
test/parallel/test-fs-read-position-validation.mjs
Copy file name to clipboardExpand all lines: test/parallel/test-fs-read-position-validation.mjs+1-2Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
75 | 75 | |
76 | 76 | |
77 | 77 | |
78 | | - |
79 | | - |
| 78 | + |
80 | 79 | |
81 | 80 | |
82 | 81 | |
|
Collapse file
test/parallel/test-fs-read-promises-position-validation.mjs
Copy file name to clipboard+84Lines changed: 84 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 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
Collapse file
test/parallel/test-fs-readSync-position-validation.mjs
Copy file name to clipboardExpand all lines: test/parallel/test-fs-readSync-position-validation.mjs+2-3Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | | - |
| 31 | + |
32 | 32 | |
33 | 33 | |
34 | 34 | |
| ||
61 | 61 | |
62 | 62 | |
63 | 63 | |
64 | | - |
65 | | - |
| 64 | + |
66 | 65 | |
67 | 66 | |
68 | 67 | |
|
0 commit comments