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

Skip to content

Commit 500b94b

Browse files
committed
rename witness to pump
1 parent c5f5206 commit 500b94b

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

javascript/ql/src/Performance/ReDoS.ql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,10 +1069,10 @@ module SuffixConstruction {
10691069
}
10701070

10711071
/**
1072-
* Holds if `term` may cause exponential backtracking on strings containing many repetitions of `witness`.
1072+
* Holds if `term` may cause exponential backtracking on strings containing many repetitions of `pump`.
10731073
* Gets the minimum possible string that causes exponential backtracking.
10741074
*/
1075-
predicate isReDoSAttackable(RegExpTerm term, string witness, State s) {
1075+
predicate isReDoSAttackable(RegExpTerm term, string pump, State s) {
10761076
exists(int i, string c | s = Match(term, i) |
10771077
c =
10781078
min(string w |
@@ -1081,7 +1081,7 @@ predicate isReDoSAttackable(RegExpTerm term, string witness, State s) {
10811081
|
10821082
w order by w.length(), w
10831083
) and
1084-
witness = escape(rotate(c, i))
1084+
pump = escape(rotate(c, i))
10851085
)
10861086
}
10871087

@@ -1111,17 +1111,17 @@ string escape(string s) {
11111111
/**
11121112
* Gets `str` with the last `i` characters moved to the front.
11131113
*
1114-
* We use this to adjust the witness string to match with the beginning of
1114+
* We use this to adjust the pump string to match with the beginning of
11151115
* a RegExpTerm, so it doesn't start in the middle of a constant.
11161116
*/
11171117
bindingset[str, i]
11181118
string rotate(string str, int i) {
11191119
result = str.suffix(str.length() - i) + str.prefix(str.length() - i)
11201120
}
11211121

1122-
from RegExpTerm t, string witness, State s, string prefixMsg
1122+
from RegExpTerm t, string pump, State s, string prefixMsg
11231123
where
1124-
isReDoSAttackable(t, witness, s) and
1124+
isReDoSAttackable(t, pump, s) and
11251125
(
11261126
prefixMsg = "starting with '" + escape(PrefixConstruction::prefix(s)) + "' and " and
11271127
not PrefixConstruction::prefix(s) = ""
@@ -1132,4 +1132,4 @@ where
11321132
)
11331133
select t,
11341134
"This part of the regular expression may cause exponential backtracking on strings " + prefixMsg +
1135-
"containing many repetitions of '" + witness + "'."
1135+
"containing many repetitions of '" + pump + "'."

0 commit comments

Comments
 (0)