Skip to content

Commit

Permalink
fix corner case in infinite recursion detection (#3926)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlamsl committed May 26, 2020
1 parent 08af3ea commit 13c72a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/ufuzz/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1177,15 +1177,15 @@ function skip_infinite_recursion(orig, toplevel) {
var code = orig;
var tries = [];
var offset = 0;
var re = /(?:(?:^|[\s{});])try|}\s*catch\s*\(([^)]+)\)|}\s*finally)\s*(?={)/g;
var re = /(?:(?:^|[\s{}):;])try|}\s*catch\s*\(([^)]+)\)|}\s*finally)\s*(?={)/g;
var match;
while (match = re.exec(code)) {
if (/}\s*finally\s*$/.test(match[0])) {
tries.shift();
continue;
}
var index = match.index + match[0].length + 1;
if (/(?:^|[\s{});])try\s*$/.test(match[0])) {
if (/(?:^|[\s{}):;])try\s*$/.test(match[0])) {
tries.unshift({ try: index - offset });
continue;
}
Expand Down

0 comments on commit 13c72a9

Please sign in to comment.