Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e177d46

Browse files
committed
add two test cases that demonstrate the limits of the suffix construction
1 parent f576144 commit e177d46

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,5 @@
121121
| tst.js:299:90:299:91 | e+ | This part of the regular expression may cause exponential backtracking on strings starting with '00000000000000' and containing many repetitions of 'e'. |
122122
| tst.js:302:18:302:19 | c+ | This part of the regular expression may cause exponential backtracking on strings starting with 'ab' and containing many repetitions of 'c'. |
123123
| tst.js:305:18:305:20 | \\s+ | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of ' '. |
124+
| tst.js:308:16:308:24 | ([^/]\|X)+ | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'X'. |
125+
| tst.js:311:20:311:24 | [^Y]+ | This part of the regular expression may cause exponential backtracking on strings starting with 'x' and containing many repetitions of 'Xx'. |

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,9 @@ var bad66 = /^ab(c+)+$/;
303303

304304
// NOT GOOD
305305
var bad67 = /(\d(\s+)*){20}/;
306+
307+
// GOOD - but we spuriously conclude that a rejecting suffix exists.
308+
var good36 = /(([^/]|X)+)(\/[^]*)*$/;
309+
310+
// GOOD - but we spuriously conclude that a rejecting suffix exists.
311+
var good37 = /^((x([^Y]+)?)*(Y|$))/;

0 commit comments

Comments
 (0)