Skip to content

Commit 2d2602b

Browse files
committed
use that strings are local-source-nodes in regex-tracking
1 parent 3cde11e commit 2d2602b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/ql/lib/semmle/python/regexp/internal/RegExpTracking.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ private import semmle.python.dataflow.new.DataFlow
1515
private import semmle.python.Concepts as Concepts
1616

1717
/** Gets a constant string value that may be used as a regular expression. */
18-
DataFlow::Node strStart() { result.asExpr() instanceof StrConst }
18+
DataFlow::LocalSourceNode strStart() { result.asExpr() instanceof StrConst }
1919

2020
private import semmle.python.regex as Regex
2121

@@ -44,7 +44,7 @@ private DataFlow::TypeTrackingNode backwards(DataFlow::TypeBackTracker t) {
4444
private DataFlow::TypeTrackingNode forwards(DataFlow::TypeTracker t) {
4545
t.start() and
4646
result = backwards(DataFlow::TypeBackTracker::end()) and
47-
result.flowsTo(strStart())
47+
result = strStart()
4848
or
4949
exists(DataFlow::TypeTracker t2 | result = forwards(t2).track(t2, t)) and
5050
result = backwards(_)
@@ -57,11 +57,11 @@ private DataFlow::TypeTrackingNode forwards(DataFlow::TypeTracker t) {
5757
* The result of the exploratory phase is used to limit the size of the search space in this precise analysis.
5858
*/
5959
private DataFlow::TypeTrackingNode regexTracking(DataFlow::Node start, DataFlow::TypeTracker t) {
60-
result = forwards(_) and
60+
result = forwards(t) and
6161
(
6262
t.start() and
6363
start = strStart() and
64-
result = start.getALocalSource()
64+
result = start
6565
or
6666
exists(DataFlow::TypeTracker t2 | result = regexTracking(start, t2).track(t2, t))
6767
)

0 commit comments

Comments
 (0)