mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Fix parsing of alternations in character classes
This commit is contained in:
@@ -807,6 +807,7 @@ abstract class RegexString extends StringLiteral {
|
||||
}
|
||||
|
||||
private predicate topLevel(int start, int end) {
|
||||
not this.inCharSet(start) and
|
||||
this.subalternation(start, end, _) and
|
||||
not this.isOptionDivider(end)
|
||||
}
|
||||
|
||||
@@ -139,3 +139,5 @@ parseFailures
|
||||
| Test.java:19:26:19:30 | \\077 | [RegExpConstant,RegExpEscape] |
|
||||
| Test.java:19:31:19:31 | 7 | [RegExpConstant,RegExpNormalChar] |
|
||||
| Test.java:19:32:19:37 | \u1337 | [RegExpConstant,RegExpNormalChar] |
|
||||
| Test.java:20:10:20:12 | [\|] | [RegExpCharacterClass] |
|
||||
| Test.java:20:11:20:11 | \| | [RegExpConstant,RegExpNormalChar] |
|
||||
|
||||
@@ -17,7 +17,7 @@ class Test {
|
||||
"(?i)(?=a)(?!b)(?<=c)(?<!d)",
|
||||
"a||b|c(d|e|)f|g",
|
||||
"\\018\\033\\0377\\0777\u1337",
|
||||
|
||||
"[|]"
|
||||
};
|
||||
|
||||
void test() {
|
||||
|
||||
Reference in New Issue
Block a user