mirror of
https://github.com/github/codeql.git
synced 2025-12-23 20:26:32 +01:00
changes based on review
This commit is contained in:
@@ -241,7 +241,7 @@ private module CharacterClasses {
|
|||||||
rangeMatchesOnLetterOrDigits(child, char)
|
rangeMatchesOnLetterOrDigits(child, char)
|
||||||
or
|
or
|
||||||
not rangeMatchesOnLetterOrDigits(child, _) and
|
not rangeMatchesOnLetterOrDigits(child, _) and
|
||||||
char = getAnyPossiblyMatchedChar() and
|
char = getARelevantChar() and
|
||||||
exists(string lo, string hi | child.(RegExpCharacterRange).isRange(lo, hi) |
|
exists(string lo, string hi | child.(RegExpCharacterRange).isRange(lo, hi) |
|
||||||
lo <= char and
|
lo <= char and
|
||||||
char <= hi
|
char <= hi
|
||||||
@@ -251,7 +251,7 @@ private module CharacterClasses {
|
|||||||
escape.getValue() = escape.getValue().toLowerCase() and
|
escape.getValue() = escape.getValue().toLowerCase() and
|
||||||
classEscapeMatches(escape.getValue(), char)
|
classEscapeMatches(escape.getValue(), char)
|
||||||
or
|
or
|
||||||
char = getAnyPossiblyMatchedChar() and
|
char = getARelevantChar() and
|
||||||
escape.getValue() = escape.getValue().toUpperCase() and
|
escape.getValue() = escape.getValue().toUpperCase() and
|
||||||
not classEscapeMatches(escape.getValue().toLowerCase(), char)
|
not classEscapeMatches(escape.getValue().toLowerCase(), char)
|
||||||
)
|
)
|
||||||
@@ -294,10 +294,10 @@ private module CharacterClasses {
|
|||||||
private string digit() { result = [0 .. 9].toString() }
|
private string digit() { result = [0 .. 9].toString() }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets any char that could possibly be matched by a regular expression.
|
* Gets a char that could be matched by a regular expression.
|
||||||
* Includes all printable ascii chars, all constants mentioned in a regexp, and all chars matches by the regexp `/\s|\d|\w/`.
|
* Includes all printable ascii chars, all constants mentioned in a regexp, and all chars matches by the regexp `/\s|\d|\w/`.
|
||||||
*/
|
*/
|
||||||
private string getAnyPossiblyMatchedChar() {
|
private string getARelevantChar() {
|
||||||
exists(ascii(result))
|
exists(ascii(result))
|
||||||
or
|
or
|
||||||
exists(RegExpConstant c | result = c.getValue().charAt(_))
|
exists(RegExpConstant c | result = c.getValue().charAt(_))
|
||||||
@@ -364,9 +364,9 @@ private module CharacterClasses {
|
|||||||
or
|
or
|
||||||
clazz = "s" and
|
clazz = "s" and
|
||||||
(
|
(
|
||||||
char = [" ", "\t", "\r", "\n", "\\u000c", "\\u000b"]
|
char = [" ", "\t", "\r", "\n"]
|
||||||
or
|
or
|
||||||
char = getAnyPossiblyMatchedChar() and
|
char = getARelevantChar() and
|
||||||
char.regexpMatch("\\u000b|\\u000c") // \v|\f (vertical tab | form feed)
|
char.regexpMatch("\\u000b|\\u000c") // \v|\f (vertical tab | form feed)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -643,7 +643,7 @@ predicate isFork(State q, InputSymbol s1, InputSymbol s2, State r1, State r2) {
|
|||||||
delta(q1, s1, r1) and
|
delta(q1, s1, r1) and
|
||||||
q2 = epsilonSucc*(q) and
|
q2 = epsilonSucc*(q) and
|
||||||
delta(q2, s2, r2) and
|
delta(q2, s2, r2) and
|
||||||
// Use pragma[noopt] to prevent compatible(s1,s2) from being the starting point of the join.
|
// Use pragma[noopt] to prevent intersect(s1,s2) from being the starting point of the join.
|
||||||
// From (s1,s2) it would find a huge number of intermediate state pairs (q1,q2) originating from different literals,
|
// From (s1,s2) it would find a huge number of intermediate state pairs (q1,q2) originating from different literals,
|
||||||
// and discover at the end that no `q` can reach both `q1` and `q2` by epsilon transitions.
|
// and discover at the end that no `q` can reach both `q1` and `q2` by epsilon transitions.
|
||||||
exists(intersect(s1, s2))
|
exists(intersect(s1, s2))
|
||||||
@@ -885,7 +885,7 @@ where
|
|||||||
min(string w |
|
min(string w |
|
||||||
isPumpable(Match(t, i), w) and
|
isPumpable(Match(t, i), w) and
|
||||||
not isPumpable(epsilonSucc+(Match(t, i)), _) and
|
not isPumpable(epsilonSucc+(Match(t, i)), _) and
|
||||||
not epsilonSucc*(process(Match(t, i), w, [0 .. w.length() - 1])) = Accept(_)
|
not epsilonSucc*(process(Match(t, i), w, _)) = Accept(_)
|
||||||
|
|
|
|
||||||
w order by w.length(), w
|
w order by w.length(), w
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user