mirror of
https://github.com/github/codeql.git
synced 2025-12-23 04:06:37 +01:00
revert marking repetitions with possibly empty body as forks
This commit is contained in:
@@ -702,28 +702,6 @@ predicate isFork(State q, InputSymbol s1, InputSymbol s2, State r1, State r2) {
|
||||
r1 != r2
|
||||
or
|
||||
r1 = r2 and q1 != q2
|
||||
or
|
||||
r1 = r2 and
|
||||
q1 = q2 and
|
||||
epsilonSucc+(q) = q and
|
||||
exists(RegExpTerm term | term = q.getRepr() | term instanceof InfiniteRepetitionQuantifier) and
|
||||
(
|
||||
// There is either multiple possible "mid" states.
|
||||
count(State mid |
|
||||
mid = epsilonSucc+(q) and
|
||||
q = epsilonSucc+(mid) and
|
||||
not mid = q
|
||||
) > 2
|
||||
or
|
||||
// Or one of the mid states is an infinite quantifier itself
|
||||
exists(State mid, RegExpTerm term |
|
||||
mid = epsilonSucc+(q) and
|
||||
q = epsilonSucc+(mid) and
|
||||
not mid = q and
|
||||
term = mid.getRepr() and
|
||||
term instanceof InfiniteRepetitionQuantifier
|
||||
)
|
||||
)
|
||||
) and
|
||||
stateInsideBacktracking(r1) and
|
||||
stateInsideBacktracking(r2)
|
||||
@@ -1164,8 +1142,7 @@ predicate isReDoSCandidate(State state, string pump) {
|
||||
bindingset[s]
|
||||
string escape(string s) {
|
||||
result =
|
||||
s
|
||||
.replaceAll("\\", "\\\\")
|
||||
s.replaceAll("\\", "\\\\")
|
||||
.replaceAll("\n", "\\n")
|
||||
.replaceAll("\r", "\\r")
|
||||
.replaceAll("\t", "\\t")
|
||||
|
||||
Reference in New Issue
Block a user