Skip to content

Commit 5e3cb08

Browse files
committed
rename stateInPumpableRegexp to stateInRelevantRegexp
1 parent 049af68 commit 5e3cb08

File tree

4 files changed

+36
-36
lines changed

4 files changed

+36
-36
lines changed

java/ql/lib/semmle/code/java/security/regexp/NfaUtils.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ module PrefixConstruction<isCandidateSig/1 isCandidate> {
891891
exists(RegExpRoot root |
892892
state =
893893
max(State s, Location l |
894-
s = stateInPumpableRegexp() and
894+
s = stateInRelevantRegexp() and
895895
isStartState(s) and
896896
getRoot(s.getRepr()) = root and
897897
l = s.getRepr().getLocation()
@@ -963,9 +963,9 @@ module PrefixConstruction<isCandidateSig/1 isCandidate> {
963963
min(string c | delta(prev, any(InputSymbol symbol | c = intersect(Any(), symbol)), next))
964964
}
965965

966-
/** Gets a state within a regular expression that has a pumpable state. */
966+
/** Gets a state within a regular expression that contains a candidate state. */
967967
pragma[noinline]
968-
State stateInPumpableRegexp() {
968+
State stateInRelevantRegexp() {
969969
exists(State s | isCandidate(s) | getRoot(s.getRepr()) = getRoot(result.getRepr()))
970970
}
971971
}
@@ -1041,7 +1041,7 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10411041
*/
10421042
pragma[noinline]
10431043
private predicate isLikelyRejectable(State s) {
1044-
s = Prefix::stateInPumpableRegexp() and
1044+
s = Prefix::stateInRelevantRegexp() and
10451045
(
10461046
// exists a reject edge with some char.
10471047
hasRejectEdge(s)
@@ -1057,15 +1057,15 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10571057
* Holds if `s` is not an accept state, and there is no epsilon transition to an accept state.
10581058
*/
10591059
predicate isRejectState(State s) {
1060-
s = Prefix::stateInPumpableRegexp() and not epsilonSucc*(s) = Accept(_)
1060+
s = Prefix::stateInRelevantRegexp() and not epsilonSucc*(s) = Accept(_)
10611061
}
10621062

10631063
/**
10641064
* Holds if there is likely a non-empty suffix leading to rejection starting in `s`.
10651065
*/
10661066
pragma[noopt]
10671067
predicate hasEdgeToLikelyRejectable(State s) {
1068-
s = Prefix::stateInPumpableRegexp() and
1068+
s = Prefix::stateInRelevantRegexp() and
10691069
// all edges (at least one) with some char leads to another state that is rejectable.
10701070
// the `next` states might not share a common suffix, which can cause FPs.
10711071
exists(string char | char = hasEdgeToLikelyRejectableHelper(s) |
@@ -1081,7 +1081,7 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10811081
*/
10821082
pragma[noinline]
10831083
private string hasEdgeToLikelyRejectableHelper(State s) {
1084-
s = Prefix::stateInPumpableRegexp() and
1084+
s = Prefix::stateInRelevantRegexp() and
10851085
not hasRejectEdge(s) and
10861086
not isRejectState(s) and
10871087
deltaClosedChar(s, result, _)
@@ -1093,8 +1093,8 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10931093
* `prev` to `next` that the character symbol `char`.
10941094
*/
10951095
predicate deltaClosedChar(State prev, string char, State next) {
1096-
prev = Prefix::stateInPumpableRegexp() and
1097-
next = Prefix::stateInPumpableRegexp() and
1096+
prev = Prefix::stateInRelevantRegexp() and
1097+
next = Prefix::stateInRelevantRegexp() and
10981098
deltaClosed(prev, getAnInputSymbolMatchingRelevant(char), next)
10991099
}
11001100

javascript/ql/lib/semmle/javascript/security/regexp/NfaUtils.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ module PrefixConstruction<isCandidateSig/1 isCandidate> {
891891
exists(RegExpRoot root |
892892
state =
893893
max(State s, Location l |
894-
s = stateInPumpableRegexp() and
894+
s = stateInRelevantRegexp() and
895895
isStartState(s) and
896896
getRoot(s.getRepr()) = root and
897897
l = s.getRepr().getLocation()
@@ -963,9 +963,9 @@ module PrefixConstruction<isCandidateSig/1 isCandidate> {
963963
min(string c | delta(prev, any(InputSymbol symbol | c = intersect(Any(), symbol)), next))
964964
}
965965

966-
/** Gets a state within a regular expression that has a pumpable state. */
966+
/** Gets a state within a regular expression that contains a candidate state. */
967967
pragma[noinline]
968-
State stateInPumpableRegexp() {
968+
State stateInRelevantRegexp() {
969969
exists(State s | isCandidate(s) | getRoot(s.getRepr()) = getRoot(result.getRepr()))
970970
}
971971
}
@@ -1041,7 +1041,7 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10411041
*/
10421042
pragma[noinline]
10431043
private predicate isLikelyRejectable(State s) {
1044-
s = Prefix::stateInPumpableRegexp() and
1044+
s = Prefix::stateInRelevantRegexp() and
10451045
(
10461046
// exists a reject edge with some char.
10471047
hasRejectEdge(s)
@@ -1057,15 +1057,15 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10571057
* Holds if `s` is not an accept state, and there is no epsilon transition to an accept state.
10581058
*/
10591059
predicate isRejectState(State s) {
1060-
s = Prefix::stateInPumpableRegexp() and not epsilonSucc*(s) = Accept(_)
1060+
s = Prefix::stateInRelevantRegexp() and not epsilonSucc*(s) = Accept(_)
10611061
}
10621062

10631063
/**
10641064
* Holds if there is likely a non-empty suffix leading to rejection starting in `s`.
10651065
*/
10661066
pragma[noopt]
10671067
predicate hasEdgeToLikelyRejectable(State s) {
1068-
s = Prefix::stateInPumpableRegexp() and
1068+
s = Prefix::stateInRelevantRegexp() and
10691069
// all edges (at least one) with some char leads to another state that is rejectable.
10701070
// the `next` states might not share a common suffix, which can cause FPs.
10711071
exists(string char | char = hasEdgeToLikelyRejectableHelper(s) |
@@ -1081,7 +1081,7 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10811081
*/
10821082
pragma[noinline]
10831083
private string hasEdgeToLikelyRejectableHelper(State s) {
1084-
s = Prefix::stateInPumpableRegexp() and
1084+
s = Prefix::stateInRelevantRegexp() and
10851085
not hasRejectEdge(s) and
10861086
not isRejectState(s) and
10871087
deltaClosedChar(s, result, _)
@@ -1093,8 +1093,8 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10931093
* `prev` to `next` that the character symbol `char`.
10941094
*/
10951095
predicate deltaClosedChar(State prev, string char, State next) {
1096-
prev = Prefix::stateInPumpableRegexp() and
1097-
next = Prefix::stateInPumpableRegexp() and
1096+
prev = Prefix::stateInRelevantRegexp() and
1097+
next = Prefix::stateInRelevantRegexp() and
10981098
deltaClosed(prev, getAnInputSymbolMatchingRelevant(char), next)
10991099
}
11001100

python/ql/lib/semmle/python/security/regexp/NfaUtils.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ module PrefixConstruction<isCandidateSig/1 isCandidate> {
891891
exists(RegExpRoot root |
892892
state =
893893
max(State s, Location l |
894-
s = stateInPumpableRegexp() and
894+
s = stateInRelevantRegexp() and
895895
isStartState(s) and
896896
getRoot(s.getRepr()) = root and
897897
l = s.getRepr().getLocation()
@@ -963,9 +963,9 @@ module PrefixConstruction<isCandidateSig/1 isCandidate> {
963963
min(string c | delta(prev, any(InputSymbol symbol | c = intersect(Any(), symbol)), next))
964964
}
965965

966-
/** Gets a state within a regular expression that has a pumpable state. */
966+
/** Gets a state within a regular expression that contains a candidate state. */
967967
pragma[noinline]
968-
State stateInPumpableRegexp() {
968+
State stateInRelevantRegexp() {
969969
exists(State s | isCandidate(s) | getRoot(s.getRepr()) = getRoot(result.getRepr()))
970970
}
971971
}
@@ -1041,7 +1041,7 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10411041
*/
10421042
pragma[noinline]
10431043
private predicate isLikelyRejectable(State s) {
1044-
s = Prefix::stateInPumpableRegexp() and
1044+
s = Prefix::stateInRelevantRegexp() and
10451045
(
10461046
// exists a reject edge with some char.
10471047
hasRejectEdge(s)
@@ -1057,15 +1057,15 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10571057
* Holds if `s` is not an accept state, and there is no epsilon transition to an accept state.
10581058
*/
10591059
predicate isRejectState(State s) {
1060-
s = Prefix::stateInPumpableRegexp() and not epsilonSucc*(s) = Accept(_)
1060+
s = Prefix::stateInRelevantRegexp() and not epsilonSucc*(s) = Accept(_)
10611061
}
10621062

10631063
/**
10641064
* Holds if there is likely a non-empty suffix leading to rejection starting in `s`.
10651065
*/
10661066
pragma[noopt]
10671067
predicate hasEdgeToLikelyRejectable(State s) {
1068-
s = Prefix::stateInPumpableRegexp() and
1068+
s = Prefix::stateInRelevantRegexp() and
10691069
// all edges (at least one) with some char leads to another state that is rejectable.
10701070
// the `next` states might not share a common suffix, which can cause FPs.
10711071
exists(string char | char = hasEdgeToLikelyRejectableHelper(s) |
@@ -1081,7 +1081,7 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10811081
*/
10821082
pragma[noinline]
10831083
private string hasEdgeToLikelyRejectableHelper(State s) {
1084-
s = Prefix::stateInPumpableRegexp() and
1084+
s = Prefix::stateInRelevantRegexp() and
10851085
not hasRejectEdge(s) and
10861086
not isRejectState(s) and
10871087
deltaClosedChar(s, result, _)
@@ -1093,8 +1093,8 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10931093
* `prev` to `next` that the character symbol `char`.
10941094
*/
10951095
predicate deltaClosedChar(State prev, string char, State next) {
1096-
prev = Prefix::stateInPumpableRegexp() and
1097-
next = Prefix::stateInPumpableRegexp() and
1096+
prev = Prefix::stateInRelevantRegexp() and
1097+
next = Prefix::stateInRelevantRegexp() and
10981098
deltaClosed(prev, getAnInputSymbolMatchingRelevant(char), next)
10991099
}
11001100

ruby/ql/lib/codeql/ruby/security/regexp/NfaUtils.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ module PrefixConstruction<isCandidateSig/1 isCandidate> {
891891
exists(RegExpRoot root |
892892
state =
893893
max(State s, Location l |
894-
s = stateInPumpableRegexp() and
894+
s = stateInRelevantRegexp() and
895895
isStartState(s) and
896896
getRoot(s.getRepr()) = root and
897897
l = s.getRepr().getLocation()
@@ -963,9 +963,9 @@ module PrefixConstruction<isCandidateSig/1 isCandidate> {
963963
min(string c | delta(prev, any(InputSymbol symbol | c = intersect(Any(), symbol)), next))
964964
}
965965

966-
/** Gets a state within a regular expression that has a pumpable state. */
966+
/** Gets a state within a regular expression that contains a candidate state. */
967967
pragma[noinline]
968-
State stateInPumpableRegexp() {
968+
State stateInRelevantRegexp() {
969969
exists(State s | isCandidate(s) | getRoot(s.getRepr()) = getRoot(result.getRepr()))
970970
}
971971
}
@@ -1041,7 +1041,7 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10411041
*/
10421042
pragma[noinline]
10431043
private predicate isLikelyRejectable(State s) {
1044-
s = Prefix::stateInPumpableRegexp() and
1044+
s = Prefix::stateInRelevantRegexp() and
10451045
(
10461046
// exists a reject edge with some char.
10471047
hasRejectEdge(s)
@@ -1057,15 +1057,15 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10571057
* Holds if `s` is not an accept state, and there is no epsilon transition to an accept state.
10581058
*/
10591059
predicate isRejectState(State s) {
1060-
s = Prefix::stateInPumpableRegexp() and not epsilonSucc*(s) = Accept(_)
1060+
s = Prefix::stateInRelevantRegexp() and not epsilonSucc*(s) = Accept(_)
10611061
}
10621062

10631063
/**
10641064
* Holds if there is likely a non-empty suffix leading to rejection starting in `s`.
10651065
*/
10661066
pragma[noopt]
10671067
predicate hasEdgeToLikelyRejectable(State s) {
1068-
s = Prefix::stateInPumpableRegexp() and
1068+
s = Prefix::stateInRelevantRegexp() and
10691069
// all edges (at least one) with some char leads to another state that is rejectable.
10701070
// the `next` states might not share a common suffix, which can cause FPs.
10711071
exists(string char | char = hasEdgeToLikelyRejectableHelper(s) |
@@ -1081,7 +1081,7 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10811081
*/
10821082
pragma[noinline]
10831083
private string hasEdgeToLikelyRejectableHelper(State s) {
1084-
s = Prefix::stateInPumpableRegexp() and
1084+
s = Prefix::stateInRelevantRegexp() and
10851085
not hasRejectEdge(s) and
10861086
not isRejectState(s) and
10871087
deltaClosedChar(s, result, _)
@@ -1093,8 +1093,8 @@ module ReDoSPruning<isCandidateSig/2 isCandidate> {
10931093
* `prev` to `next` that the character symbol `char`.
10941094
*/
10951095
predicate deltaClosedChar(State prev, string char, State next) {
1096-
prev = Prefix::stateInPumpableRegexp() and
1097-
next = Prefix::stateInPumpableRegexp() and
1096+
prev = Prefix::stateInRelevantRegexp() and
1097+
next = Prefix::stateInRelevantRegexp() and
10981098
deltaClosed(prev, getAnInputSymbolMatchingRelevant(char), next)
10991099
}
11001100

0 commit comments

Comments
 (0)