Skip to content

Commit b2b736d

Browse files
committed
add more tests for non-empty positive lookaheads
1 parent a07de3f commit b2b736d

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

javascript/ql/test/query-tests/Performance/ReDoS/PolynomialBackTracking.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,3 +497,7 @@
497497
| tst.js:372:24:372:30 | [^"\\s]+ | Strings with many repetitions of '!' can start matching anywhere after the start of the preceeding ("[^"]*?"\|[^"\\s]+)+ |
498498
| tst.js:373:16:373:21 | [^"]*? | Strings starting with '"' and with many repetitions of '""' can start matching anywhere after the start of the preceeding ("[^"]*?"\|[^"\\s]+)+(?=X) |
499499
| tst.js:373:24:373:30 | [^"\\s]+ | Strings with many repetitions of '!' can start matching anywhere after the start of the preceeding ("[^"]*?"\|[^"\\s]+)+ |
500+
| tst.js:374:15:374:16 | x* | Strings with many repetitions of 'x' can start matching anywhere after the start of the preceeding (x*)+(?=$) |
501+
| tst.js:375:15:375:16 | x* | Strings with many repetitions of 'x' can start matching anywhere after the start of the preceeding (x*)+(?=$\|y) |
502+
| tst.js:376:15:376:21 | [\\s\\S]* | Strings with many repetitions of 'a' can start matching anywhere after the start of the preceeding ([\\s\\S]*)+(?=$) |
503+
| tst.js:377:15:377:21 | [\\s\\S]* | Strings with many repetitions of 'a' can start matching anywhere after the start of the preceeding ([\\s\\S]*)+(?=$\|y) |

javascript/ql/test/query-tests/Performance/ReDoS/ReDoS.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,7 @@
174174
| tst.js:363:15:363:38 | ((?:a{0,2\|-)\|\\w\\{\\d,\\d)+ | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'a{0,2'. |
175175
| tst.js:372:24:372:30 | [^"\\s]+ | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '!'. |
176176
| tst.js:373:24:373:30 | [^"\\s]+ | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '!'. |
177+
| tst.js:374:15:374:16 | x* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'x'. |
178+
| tst.js:375:15:375:16 | x* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'x'. |
179+
| tst.js:376:15:376:21 | [\\s\\S]* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'a'. |
180+
| tst.js:377:15:377:21 | [\\s\\S]* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'a'. |

javascript/ql/test/query-tests/Performance/ReDoS/tst.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,4 +370,8 @@ var good43 = /("[^"]*?"|[^"\s]+)+(?=\s*|\s*$)/g;
370370

371371
// BAD
372372
var bad87 = /("[^"]*?"|[^"\s]+)+(?=\s*|\s*$)X/g;
373-
var bad88 = /("[^"]*?"|[^"\s]+)+(?=X)/g;
373+
var bad88 = /("[^"]*?"|[^"\s]+)+(?=X)/g;
374+
var bad89 = /(x*)+(?=$)/
375+
var bad90 = /(x*)+(?=$|y)/
376+
var bad91 = /([\s\S]*)+(?=$)/
377+
var bad92 = /([\s\S]*)+(?=$|y)/

0 commit comments

Comments
 (0)