mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
Python points-to: Remove negative recursion when using legacy points-to in legacy points-to extensions.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
| 1 | ControlFlowNode for unicode_literals | ImportMember | 1 |
|
||||
| 2 | ControlFlowNode for C | class C | 2 |
|
||||
| 2 | ControlFlowNode for ClassExpr | class C | 2 |
|
||||
| 2 | ControlFlowNode for object | builtin-class object | 2 |
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
WARNING: Type CustomPointsToAttribute has been deprecated and may be removed in future (Extend.ql:26,35-58)
|
||||
WARNING: Type CustomPointsToObjectFact has been deprecated and may be removed in future (Extend.ql:41,32-56)
|
||||
WARNING: Type CustomPointsToOriginFact has been deprecated and may be removed in future (Extend.ql:8,28-52)
|
||||
WARNING: Predicate points_to has been deprecated and may be removed in future (Extend.ql:58,9-28)
|
||||
WARNING: Type CustomPointsToAttribute has been deprecated and may be removed in future (Extend.ql:27,35-58)
|
||||
WARNING: Type CustomPointsToObjectFact has been deprecated and may be removed in future (Extend.ql:42,32-56)
|
||||
WARNING: Type CustomPointsToOriginFact has been deprecated and may be removed in future (Extend.ql:9,28-52)
|
||||
WARNING: Type CustomPointsToOriginFact has been deprecated and may be removed in future (Extend.ql:55,38-62)
|
||||
| test.py:4:1:4:3 | ControlFlowNode for one | int 1 |
|
||||
| test.py:5:1:5:3 | ControlFlowNode for two | int 2 |
|
||||
| test.py:8:1:8:1 | ControlFlowNode for IntegerLiteral | int 1 |
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import python
|
||||
|
||||
import semmle.python.pointsto.PointsTo
|
||||
private import semmle.python.types.Extensions
|
||||
|
||||
|
||||
@@ -50,6 +51,18 @@ class NoClassExtension extends CustomPointsToObjectFact {
|
||||
|
||||
}
|
||||
|
||||
/* Check that we can use old API without causing non-monotonic recursion */
|
||||
class RecurseIntoOldPointsTo extends CustomPointsToOriginFact {
|
||||
|
||||
RecurseIntoOldPointsTo() {
|
||||
PointsTo::points_to(this, _, unknownValue(), _, _)
|
||||
}
|
||||
|
||||
override predicate pointsTo(Object value, ClassObject cls) {
|
||||
value = unknownValue() and cls = theUnknownType()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
from ControlFlowNode f, Object o
|
||||
where f.getLocation().getFile().getBaseName() = "test.py" and f.refersTo(o)
|
||||
|
||||
@@ -98,7 +98,6 @@
|
||||
| Module pointsto_test | 76 | ControlFlowNode for sys | Module sys |
|
||||
| Module pointsto_test | 76 | ControlFlowNode for type | builtin-class type |
|
||||
| Module pointsto_test | 76 | ControlFlowNode for type() | builtin-class module |
|
||||
| Module pointsto_test | 77 | ControlFlowNode for unknown | ImportMember |
|
||||
| Module pointsto_test | 78 | ControlFlowNode for type | builtin-class type |
|
||||
| Module pointsto_test | 79 | ControlFlowNode for Dict | Dict |
|
||||
| Module pointsto_test | 79 | ControlFlowNode for Tuple | Tuple |
|
||||
|
||||
@@ -106,7 +106,6 @@
|
||||
| 76 | ControlFlowNode for sys | Module sys |
|
||||
| 76 | ControlFlowNode for type | builtin-class type |
|
||||
| 76 | ControlFlowNode for type() | builtin-class module |
|
||||
| 77 | ControlFlowNode for unknown | ImportMember |
|
||||
| 78 | ControlFlowNode for type | builtin-class type |
|
||||
| 79 | ControlFlowNode for Dict | Dict |
|
||||
| 79 | ControlFlowNode for Tuple | Tuple |
|
||||
|
||||
@@ -1142,7 +1142,6 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
|
||||
| t_type.py:7 | ControlFlowNode for sys | Module sys | builtin-class module | 1 | import |
|
||||
| t_type.py:7 | ControlFlowNode for type | builtin-class type | builtin-class type | 7 | import |
|
||||
| t_type.py:7 | ControlFlowNode for type() | builtin-class module | builtin-class type | 7 | import |
|
||||
| t_type.py:8 | ControlFlowNode for unknown | ImportMember | *UNKNOWN TYPE* | 8 | import |
|
||||
| t_type.py:9 | ControlFlowNode for type | builtin-class type | builtin-class type | 9 | import |
|
||||
| t_type.py:9 | ControlFlowNode for type() | *UNKNOWN TYPE* | *UNKNOWN TYPE* | 9 | import |
|
||||
| t_type.py:10 | ControlFlowNode for Dict | Dict | builtin-class dict | 10 | import |
|
||||
|
||||
Reference in New Issue
Block a user