66class PolyRedosTest {
77 void test (HttpServletRequest request ) {
88 String tainted = request .getParameter ("inp" );
9- String reg = "a \\ .\\ d+E?\\ d+b " ;
9+ String reg = "0 \\ .\\ d+E?\\ d+! " ;
1010 Predicate <String > dummyPred = (s -> s .length () % 7 == 0 );
1111
12- tainted .matches (reg ); // $ hasTaintFlow
13- tainted .split (reg ); // $ hasTaintFlow
14- tainted .split (reg , 7 ); // $ hasTaintFlow
15- Pattern .matches (reg , tainted ); // $ hasTaintFlow
16- Pattern .compile (reg ).matcher (tainted ).matches (); // $ hasTaintFlow
17- Pattern .compile (reg ).split (tainted ); // $ hasTaintFlow
18- Pattern .compile (reg , Pattern .DOTALL ).split (tainted ); // $ hasTaintFlow
19- Pattern .compile (reg ).split (tainted , 7 ); // $ hasTaintFlow
20- Pattern .compile (reg ).splitAsStream (tainted ); // $ hasTaintFlow
21- Pattern .compile (reg ).asPredicate ().test (tainted ); // $ hasTaintFlow
22- Pattern .compile (reg ).asMatchPredicate ().negate ().and (dummyPred ).or (dummyPred ).test (tainted ); // $ hasTaintFlow
23- Predicate .not (dummyPred .and (dummyPred .or (Pattern .compile (reg ).asPredicate ()))).test (tainted ); // $ hasTaintFlow
12+ tainted .matches (reg ); // $ hasPolyRedos
13+ tainted .split (reg ); // $ hasPolyRedos
14+ tainted .split (reg , 7 ); // $ hasPolyRedos
15+ Pattern .matches (reg , tainted ); // $ hasPolyRedos
16+ Pattern .compile (reg ).matcher (tainted ).matches (); // $ hasPolyRedos
17+ Pattern .compile (reg ).split (tainted ); // $ hasPolyRedos
18+ Pattern .compile (reg , Pattern .DOTALL ).split (tainted ); // $ hasPolyRedos
19+ Pattern .compile (reg ).split (tainted , 7 ); // $ hasPolyRedos
20+ Pattern .compile (reg ).splitAsStream (tainted ); // $ hasPolyRedos
21+ Pattern .compile (reg ).asPredicate ().test (tainted ); // $ hasPolyRedos
22+ Pattern .compile (reg ).asMatchPredicate ().negate ().and (dummyPred ).or (dummyPred ).test (tainted ); // $ hasPolyRedos
23+ Predicate .not (dummyPred .and (dummyPred .or (Pattern .compile (reg ).asPredicate ()))).test (tainted ); // $ hasPolyRedos
2424
25- Splitter .on (Pattern .compile (reg )).split (tainted ); // $ hasTaintFlow
25+ Splitter .on (Pattern .compile (reg )).split (tainted ); // $ hasPolyRedos
2626 Splitter .on (reg ).split (tainted );
27- Splitter .onPattern (reg ).split (tainted ); // $ hasTaintFlow
28- Splitter .onPattern (reg ).splitToList (tainted ); // $ hasTaintFlow
29- Splitter .onPattern (reg ).limit (7 ).omitEmptyStrings ().trimResults ().split (tainted ); // $ hasTaintFlow
30- Splitter .onPattern (reg ).withKeyValueSeparator (" => " ).split (tainted ); // $ hasTaintFlow
27+ Splitter .onPattern (reg ).split (tainted ); // $ hasPolyRedos
28+ Splitter .onPattern (reg ).splitToList (tainted ); // $ hasPolyRedos
29+ Splitter .onPattern (reg ).limit (7 ).omitEmptyStrings ().trimResults ().split (tainted ); // $ hasPolyRedos
30+ Splitter .onPattern (reg ).withKeyValueSeparator (" => " ).split (tainted ); // $ hasPolyRedos
3131 Splitter .on (";" ).withKeyValueSeparator (reg ).split (tainted );
32- Splitter .on (";" ).withKeyValueSeparator (Splitter .onPattern (reg )).split (tainted ); // $ hasTaintFlow
32+ Splitter .on (";" ).withKeyValueSeparator (Splitter .onPattern (reg )).split (tainted ); // $ hasPolyRedos
3333
3434 }
3535}
0 commit comments