Skip to content

Commit 5f55cb0

Browse files
authored
Merge pull request #1691 from markshannon/python-fewer-missing-edges
Python: Make a few more expressions point-to the 'unknown' value.
2 parents 5d6ac2b + c2f9189 commit 5f55cb0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

python/ql/src/semmle/python/pointsto/PointsTo.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,14 @@ module Expressions {
13961396
)
13971397
}
13981398

1399+
pragma [noinline]
1400+
private boolean comparesToUnknown(CompareNode comp, PointsToContext context, ControlFlowNode operand, ObjectInternal opvalue) {
1401+
(comp.operands(operand, _, _) or comp.operands(_, _, operand)) and
1402+
PointsToInternal::pointsTo(operand, context, opvalue, _) and
1403+
opvalue = ObjectInternal::unknown() and
1404+
result = maybe()
1405+
}
1406+
13991407
pragma [noinline]
14001408
private predicate equalityTest(CompareNode comp, PointsToContext context, ControlFlowNode operand, ObjectInternal opvalue, ObjectInternal other, boolean sense) {
14011409
exists(ControlFlowNode r |
@@ -1526,6 +1534,8 @@ module Expressions {
15261534
or
15271535
result = containsComparisonEvaluatesTo(expr, context, subexpr, subvalue)
15281536
or
1537+
result = comparesToUnknown(expr, context, subexpr, subvalue)
1538+
or
15291539
result = isinstanceEvaluatesTo(expr, context, subexpr, subvalue)
15301540
or
15311541
result = issubclassEvaluatesTo(expr, context, subexpr, subvalue)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| 1189 |
1+
| 1185 |

0 commit comments

Comments
 (0)