Skip to content

Commit 660398a

Browse files
committed
Python: Introduce TypeBackTracker::getACompatibleTypeTracker()
1 parent 73fd66c commit 660398a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/TypeTracker.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,19 @@ class TypeBackTracker extends TTypeBackTracker {
465465
simpleLocalFlowStep(nodeFrom, nodeTo) and
466466
this = result
467467
}
468+
469+
/**
470+
* Gets a forwards summary that is compatible with this backwards summary.
471+
* That is, if this summary describes the steps needed to back-track a value
472+
* from `sink` to `mid`, and the result is a valid summary of the steps needed
473+
* to track a value from `source` to `mid`, then the value from `source` may
474+
* also flow to `sink`.
475+
*/
476+
TypeTracker getACompatibleTypeTracker() {
477+
exists(boolean hasCall | result = MkTypeTracker(hasCall, content) |
478+
hasCall = false or hasReturn() = false
479+
)
480+
}
468481
}
469482

470483
/** Provides predicates for implementing custom `TypeBackTracker`s. */

0 commit comments

Comments
 (0)