Skip to content

Commit f5059a6

Browse files
committed
Python: fix computation at part boundaries
1 parent cdf1db0 commit f5059a6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

python/ql/lib/semmle/python/regexp/RegexTreeView.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ module Impl implements RegexTreeViewSig {
239239
* `localOffset` will be the offset of this `RegExpTerm` inside `result`.
240240
*/
241241
StringPart getPart(int localOffset) {
242-
exists(int index, int prefixLength | index = max(int i | this.getPartOffset(i) < start) |
242+
exists(int index, int prefixLength | index = max(int i | this.getPartOffset(i) <= start) |
243243
result = re.(StrConst).getImplicitlyConcatenatedPart(index) and
244244
result.contextSize(prefixLength, _) and
245245
// Example:

python/ql/test/library-tests/regexparser/locations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
)
5656

5757
# plain string with multiple parts across lines
58-
re.compile( # $ location=1:2 location=2:7 SPURIOUS:location=2:29 MISSING:location=3:2
58+
re.compile( # $ location=1:2 location=2:7 location=3:2
5959
'[this] is a test'
6060
' and [this] is another test'
6161
'[this] comes right at the start of a part'

0 commit comments

Comments
 (0)