Skip to content

Commit 13c72a9

Browse files
authored
fix corner case in infinite recursion detection (#3926)
1 parent 08af3ea commit 13c72a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/ufuzz/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,15 +1177,15 @@ function skip_infinite_recursion(orig, toplevel) {
11771177
var code = orig;
11781178
var tries = [];
11791179
var offset = 0;
1180-
var re = /(?:(?:^|[\s{});])try|}\s*catch\s*\(([^)]+)\)|}\s*finally)\s*(?={)/g;
1180+
var re = /(?:(?:^|[\s{}):;])try|}\s*catch\s*\(([^)]+)\)|}\s*finally)\s*(?={)/g;
11811181
var match;
11821182
while (match = re.exec(code)) {
11831183
if (/}\s*finally\s*$/.test(match[0])) {
11841184
tries.shift();
11851185
continue;
11861186
}
11871187
var index = match.index + match[0].length + 1;
1188-
if (/(?:^|[\s{});])try\s*$/.test(match[0])) {
1188+
if (/(?:^|[\s{}):;])try\s*$/.test(match[0])) {
11891189
tries.unshift({ try: index - offset });
11901190
continue;
11911191
}

0 commit comments

Comments
 (0)