Commit 34f4934
fs: fix stack overflow in fs.readdirSync
Previously, fs.readdirSync calls the function returned by
env->push_values_to_array_function() in batch and check the returned
Maybe right away in C++, which can lead to assertions if the call stack
already reaches the maximum size. This patch fixes that by returning
early the call fails so the stack overflow error will be properly
thrown into JS land.
PR-URL: #18647
Fixes: #18645
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent a7419d0 commit 34f4934Copy full SHA for 34f4934
File tree
Expand file treeCollapse file tree
2 files changed
+27
-3
lines changedOpen diff view settings
Filter options
- src
- test/parallel
Expand file treeCollapse file tree
2 files changed
+27
-3
lines changedOpen diff view settings
Collapse file
+9-3Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
909 | 909 | |
910 | 910 | |
911 | 911 | |
912 | | - |
913 | | - |
| 912 | + |
| 913 | + |
| 914 | + |
| 915 | + |
| 916 | + |
914 | 917 | |
915 | 918 | |
916 | 919 | |
917 | 920 | |
918 | 921 | |
919 | | - |
| 922 | + |
| 923 | + |
| 924 | + |
| 925 | + |
920 | 926 | |
921 | 927 | |
922 | 928 | |
|
Collapse file
test/parallel/test-fs-readdir-stack-overflow.js
Copy file name to clipboard+18Lines changed: 18 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 | + |
0 commit comments