Skip to content

Commit bc17d4b

Browse files
smowtonjoefarebrother
authored andcommitted
Break the recursion between seqChild, RegExpTerm and TRegExpSequence
1 parent 0d13864 commit bc17d4b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ private newtype TRegExpParent =
2020
/** A sequence term */
2121
TRegExpSequence(Regex re, int start, int end) {
2222
re.sequence(start, end) and
23-
exists(seqChild(re, start, end, 1)) // if a sequence does not have more than one element, it should be treated as that element instead.
23+
// Only create sequence nodes for sequences with two or more children.
24+
exists(int mid |
25+
re.item(start, mid) and
26+
re.item(mid, _)
27+
)
2428
} or
2529
/** An alternation term */
2630
TRegExpAlt(Regex re, int start, int end) {

0 commit comments

Comments
 (0)