Skip to content

Commit cc1de1a

Browse files
authored
JS FS: Don't return ELOOP on a path with a large number of ..'s (#24591)
Decrement nlinks before doing `continue linkloop;` due to a .. at a file system loop. We're not actually traversing a symlink here. Caught by the Python test suite.
1 parent bbe1752 commit cc1de1a

22 files changed

+38
-20
lines changed

src/lib/libfs.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ FS.staticInit();`;
197197
current_path = PATH.dirname(current_path);
198198
if (FS.isRoot(current)) {
199199
path = current_path + '/' + parts.slice(i + 1).join('/');
200+
// We're making progress here, don't let many consecutive ..'s
201+
// lead to ELOOP
202+
nlinks--;
200203
continue linkloop;
201204
} else {
202205
current = current.parent;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8167
1+
8171
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19798
1+
19802
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8155
1+
8160
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19776
1+
19780
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9154
1+
9159
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
23459
1+
23463
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8115
1+
8119
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19687
1+
19691
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8115
1+
8119

0 commit comments

Comments
 (0)