File tree Expand file tree Collapse file tree
javascript/ql/lib/semmle/javascript/security/performance
python/ql/lib/semmle/python/security/performance Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -803,29 +803,26 @@ InputSymbol getAnInputSymbolMatching(string char) {
803803 result = Any ( )
804804}
805805
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+
806815/**
807816 * Predicates for constructing a prefix string that leads to a given state.
808817 */
809818private 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-
822819 /**
823820 * Holds if `state` is the textually last start state for the regular expression.
824821 */
825822 private predicate lastStartState ( State state ) {
826823 exists ( RegExpRoot root |
827824 state =
828- max ( State s , Location l |
825+ max ( StateInPumpableRegexp s , Location l |
829826 isStartState ( s ) and getRoot ( s .getRepr ( ) ) = root and l = s .getRepr ( ) .getLocation ( )
830827 |
831828 s
Original file line number Diff line number Diff line change @@ -803,29 +803,26 @@ InputSymbol getAnInputSymbolMatching(string char) {
803803 result = Any ( )
804804}
805805
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+
806815/**
807816 * Predicates for constructing a prefix string that leads to a given state.
808817 */
809818private 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-
822819 /**
823820 * Holds if `state` is the textually last start state for the regular expression.
824821 */
825822 private predicate lastStartState ( State state ) {
826823 exists ( RegExpRoot root |
827824 state =
828- max ( State s , Location l |
825+ max ( StateInPumpableRegexp s , Location l |
829826 isStartState ( s ) and getRoot ( s .getRepr ( ) ) = root and l = s .getRepr ( ) .getLocation ( )
830827 |
831828 s
You can’t perform that action at this time.
0 commit comments