diff --git a/python/ql/lib/semmle/python/regexp/RegexTreeView.qll b/python/ql/lib/semmle/python/regexp/RegexTreeView.qll index 822f861d91a..1102e9d006b 100644 --- a/python/ql/lib/semmle/python/regexp/RegexTreeView.qll +++ b/python/ql/lib/semmle/python/regexp/RegexTreeView.qll @@ -239,7 +239,7 @@ module Impl implements RegexTreeViewSig { * `localOffset` will be the offset of this `RegExpTerm` inside `result`. */ StringPart getPart(int localOffset) { - exists(int index, int prefixLength | index = max(int i | this.getPartOffset(i) < start) | + exists(int index, int prefixLength | index = max(int i | this.getPartOffset(i) <= start) | result = re.(StrConst).getImplicitlyConcatenatedPart(index) and result.contextSize(prefixLength, _) and // Example: diff --git a/python/ql/test/library-tests/regexparser/locations.py b/python/ql/test/library-tests/regexparser/locations.py index 19867bda0be..133ba528ce1 100644 --- a/python/ql/test/library-tests/regexparser/locations.py +++ b/python/ql/test/library-tests/regexparser/locations.py @@ -55,7 +55,7 @@ re.compile( # $ location=1:2 location=1:26 ) # plain string with multiple parts across lines -re.compile( # $ location=1:2 location=2:7 SPURIOUS:location=2:29 MISSING:location=3:2 +re.compile( # $ location=1:2 location=2:7 location=3:2 '[this] is a test' ' and [this] is another test' '[this] comes right at the start of a part'