File tree Expand file tree Collapse file tree 2 files changed +20
-26
lines changed
javascript/ql/lib/semmle/javascript/security/performance
python/ql/lib/semmle/python/security/performance Expand file tree Collapse file tree 2 files changed +20
-26
lines changed Original file line number Diff line number Diff line change @@ -803,29 +803,26 @@ InputSymbol getAnInputSymbolMatching(string char) {
803
803
result = Any ( )
804
804
}
805
805
806
+ /**
807
+ * Holds if `state` is a start state.
808
+ */
809
+ predicate isStartState ( State state ) {
810
+ state = mkMatch ( any ( RegExpRoot r ) )
811
+ or
812
+ exists ( RegExpCaret car | state = after ( car ) )
813
+ }
814
+
806
815
/**
807
816
* Predicates for constructing a prefix string that leads to a given state.
808
817
*/
809
818
private module PrefixConstruction {
810
- /**
811
- * Holds if `state` starts the string matched by the regular expression.
812
- */
813
- private predicate isStartState ( State state ) {
814
- state instanceof StateInPumpableRegexp and
815
- (
816
- state = Match ( any ( RegExpRoot r ) , _)
817
- or
818
- exists ( RegExpCaret car | state = after ( car ) )
819
- )
820
- }
821
-
822
819
/**
823
820
* Holds if `state` is the textually last start state for the regular expression.
824
821
*/
825
822
private predicate lastStartState ( State state ) {
826
823
exists ( RegExpRoot root |
827
824
state =
828
- max ( State s , Location l |
825
+ max ( StateInPumpableRegexp s , Location l |
829
826
isStartState ( s ) and getRoot ( s .getRepr ( ) ) = root and l = s .getRepr ( ) .getLocation ( )
830
827
|
831
828
s
Original file line number Diff line number Diff line change @@ -803,29 +803,26 @@ InputSymbol getAnInputSymbolMatching(string char) {
803
803
result = Any ( )
804
804
}
805
805
806
+ /**
807
+ * Holds if `state` is a start state.
808
+ */
809
+ predicate isStartState ( State state ) {
810
+ state = mkMatch ( any ( RegExpRoot r ) )
811
+ or
812
+ exists ( RegExpCaret car | state = after ( car ) )
813
+ }
814
+
806
815
/**
807
816
* Predicates for constructing a prefix string that leads to a given state.
808
817
*/
809
818
private module PrefixConstruction {
810
- /**
811
- * Holds if `state` starts the string matched by the regular expression.
812
- */
813
- private predicate isStartState ( State state ) {
814
- state instanceof StateInPumpableRegexp and
815
- (
816
- state = Match ( any ( RegExpRoot r ) , _)
817
- or
818
- exists ( RegExpCaret car | state = after ( car ) )
819
- )
820
- }
821
-
822
819
/**
823
820
* Holds if `state` is the textually last start state for the regular expression.
824
821
*/
825
822
private predicate lastStartState ( State state ) {
826
823
exists ( RegExpRoot root |
827
824
state =
828
- max ( State s , Location l |
825
+ max ( StateInPumpableRegexp s , Location l |
829
826
isStartState ( s ) and getRoot ( s .getRepr ( ) ) = root and l = s .getRepr ( ) .getLocation ( )
830
827
|
831
828
s
You can’t perform that action at this time.
0 commit comments