Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5551143

Browse files
committed
Python points-to. Don't let unknown values escape refersTo().
1 parent abf0347 commit 5551143

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

python/ql/src/semmle/python/Flow.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ class ControlFlowNode extends @py_flow_node {
244244
/** Gets what this expression might "refer-to" in the given `context`.
245245
*/
246246
predicate refersTo(Context context, Object obj, ClassObject cls, ControlFlowNode origin) {
247+
not obj = unknownValue() and
248+
not cls = theUnknownType() and
247249
PointsTo::points_to(this, context, obj, cls, origin)
248250
}
249251

@@ -252,6 +254,7 @@ class ControlFlowNode extends @py_flow_node {
252254
* where the class cannot be inferred.
253255
*/
254256
predicate refersTo(Object obj, ControlFlowNode origin) {
257+
not obj = unknownValue() and
255258
PointsTo::points_to(this, _, obj, _, origin)
256259
}
257260

0 commit comments

Comments
 (0)