Skip to content

Commit c7d3008

Browse files
Fix issue with named backrefs; add needed import
1 parent 2d82dfb commit c7d3008

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

java/ql/lib/semmle/code/java/regex/RegexTreeView.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ class RegExpQuantifier extends RegExpTerm, TRegExpQuantifier {
258258
result.occursInRegex(re, start, part_end)
259259
}
260260

261+
/** Holds if this term may match zero times. */
262+
predicate mayBeEmpty() { maybe_empty = true }
263+
261264
/** Holds if this term may match an unlimited number of times. */
262265
predicate mayRepeatForever() { may_repeat_forever = true }
263266

java/ql/lib/semmle/code/java/regex/regex.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ abstract class RegexString extends StringLiteral {
112112
this.getChar(start + 1) = "k" and
113113
this.getChar(start + 2) = "<" and
114114
end = min(int i | i > start + 2 and this.getChar(i) = ">") + 1 and
115-
name = this.getText().substring(start + 3, end - 2)
115+
name = this.getText().substring(start + 3, end - 1)
116116
}
117117

118118
private predicate numberedBackreference(int start, int end, int value) {

java/ql/lib/semmle/code/java/security/performance/ReDoSUtilSpecific.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
private import java
7+
import semmle.code.FileSystem
78
import semmle.code.java.regex.RegexTreeView
89

910
/**

0 commit comments

Comments
 (0)