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

Skip to content

Commit 1b3c3ef

Browse files
committed
adjust comments in ReDoS test case
1 parent 11d878b commit 1b3c3ef

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • javascript/ql/test/query-tests/Performance/ReDoS

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,19 +268,19 @@ var good28 = /foo([\uDC66\uDC67]|[\uDC68\uDC69])*foo/
268268
// GOOD
269269
var good29 = /foo((\uDC66|\uDC67)|(\uDC68|\uDC69))*foo/
270270

271-
// NOT GOOD - but cannot currently construct a prefix
271+
// NOT GOOD (but cannot currently construct a prefix)
272272
var bad62 = /a{2,3}(b+)+X/;
273273

274-
// NOT GOOD - and a good prefix test
274+
// NOT GOOD (and a good prefix test)
275275
var bad63 = /^<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
276276

277277
// GOOD
278278
var good30 = /(a+)*[^][^][^]?/;
279279

280-
// GOOD - but we fail to see that repeating the attack string ends in the "accept any" state.
280+
// GOOD - but we fail to see that repeating the attack string ends in the "accept any" state (due to not parsing the range `[^]{2,3}`).
281281
var good31 = /(a+)*[^]{2,3}/;
282282

283-
// GOOD - but we don't find that no suffix is rejected
283+
// GOOD - but we spuriously conclude that a rejecting suffix exists (due to not parsing the range `[^]{2,}` when constructing the NFA).
284284
var good32 = /(a+)*([^]{2,}|X)$/;
285285

286286
// GOOD
@@ -290,12 +290,12 @@ var good33 = /(a+)*([^]*|X)$/;
290290
var bad64 = /((a+)*$|[^]+)/;
291291

292292
// GOOD - but still flagged. The only change compared to the above is the order of alternatives, which we don't model.
293-
var good34 = /((a+)*$|[^]+)/;
293+
var good34 = /([^]+|(a+)*$)/;
294294

295295
// GOOD
296296
var good35 = /((;|^)a+)+$/;
297297

298-
// NOT GOOD - a good prefix test
298+
// NOT GOOD (a good prefix test)
299299
var bad65 = /(^|;)(0|1)(0|1)(0|1)(0|1)(0|1)(0|1)(0|1)(0|1)(0|1)(0|1)(0|1)(0|1)(0|1)(0|1)(e+)+f/;
300300

301301
// NOT GOOD

0 commit comments

Comments
 (0)