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

Skip to content

Commit 96ba9a2

Browse files
committed
Python points-to. Do not track tuples on lhs of assignment or in deletions.
1 parent 5724fb0 commit 96ba9a2

3 files changed

Lines changed: 1 addition & 8 deletions

File tree

python/ql/src/semmle/python/objects/TObject.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ cached newtype TObject =
177177
or
178178
/* Represents a tuple in the Python source */
179179
TPythonTuple(TupleNode origin, PointsToContext context) {
180+
origin.isLoad() and
180181
context.appliesTo(origin)
181182
}
182183
or

python/ql/test/library-tests/PointsTo/new/PointsToWithContext.expected

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
2222
| a_simple.py:18 | ControlFlowNode for multi_loop | Function multi_loop | builtin-class function | 18 | import |
2323
| a_simple.py:19 | ControlFlowNode for None | NoneType None | builtin-class NoneType | 19 | runtime |
2424
| a_simple.py:19 | ControlFlowNode for x | NoneType None | builtin-class NoneType | 19 | runtime |
25-
| a_simple.py:20 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 20 | runtime |
2625
| a_simple.py:23 | ControlFlowNode for FunctionExpr | Function with_definition | builtin-class function | 23 | import |
2726
| a_simple.py:23 | ControlFlowNode for with_definition | Function with_definition | builtin-class function | 23 | import |
2827
| a_simple.py:27 | ControlFlowNode for FunctionExpr | Function multi_loop_in_try | builtin-class function | 27 | import |
2928
| a_simple.py:27 | ControlFlowNode for multi_loop_in_try | Function multi_loop_in_try | builtin-class function | 27 | import |
30-
| a_simple.py:29 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 29 | runtime |
3129
| a_simple.py:31 | ControlFlowNode for KeyError | builtin-class KeyError | builtin-class type | 31 | runtime |
3230
| a_simple.py:34 | ControlFlowNode for FunctionExpr | Function f | builtin-class function | 34 | import |
3331
| a_simple.py:34 | ControlFlowNode for args | args | builtin-class tuple | 34 | runtime |
@@ -55,10 +53,8 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
5553
| a_simple.py:40 | ControlFlowNode for c | 'c' | builtin-class str | 38 | runtime |
5654
| a_simple.py:40 | ControlFlowNode for w | Tuple | builtin-class tuple | 40 | runtime |
5755
| a_simple.py:41 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 39 | runtime |
58-
| a_simple.py:41 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 41 | runtime |
5956
| a_simple.py:41 | ControlFlowNode for t | Tuple | builtin-class tuple | 39 | runtime |
6057
| a_simple.py:42 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 40 | runtime |
61-
| a_simple.py:42 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 42 | runtime |
6258
| a_simple.py:42 | ControlFlowNode for w | Tuple | builtin-class tuple | 40 | runtime |
6359
| a_simple.py:49 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 49 | runtime |
6460
| a_simple.py:49 | ControlFlowNode for b | 'b' | builtin-class str | 38 | runtime |

python/ql/test/library-tests/PointsTo/new/PointsToWithType.expected

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
2222
| a_simple.py:18 | ControlFlowNode for multi_loop | Function multi_loop | builtin-class function | 18 |
2323
| a_simple.py:19 | ControlFlowNode for None | NoneType None | builtin-class NoneType | 19 |
2424
| a_simple.py:19 | ControlFlowNode for x | NoneType None | builtin-class NoneType | 19 |
25-
| a_simple.py:20 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 20 |
2625
| a_simple.py:23 | ControlFlowNode for FunctionExpr | Function with_definition | builtin-class function | 23 |
2726
| a_simple.py:23 | ControlFlowNode for with_definition | Function with_definition | builtin-class function | 23 |
2827
| a_simple.py:27 | ControlFlowNode for FunctionExpr | Function multi_loop_in_try | builtin-class function | 27 |
2928
| a_simple.py:27 | ControlFlowNode for multi_loop_in_try | Function multi_loop_in_try | builtin-class function | 27 |
30-
| a_simple.py:29 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 29 |
3129
| a_simple.py:31 | ControlFlowNode for KeyError | builtin-class KeyError | builtin-class type | 31 |
3230
| a_simple.py:34 | ControlFlowNode for FunctionExpr | Function f | builtin-class function | 34 |
3331
| a_simple.py:34 | ControlFlowNode for args | args | builtin-class tuple | 34 |
@@ -55,10 +53,8 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
5553
| a_simple.py:40 | ControlFlowNode for c | 'c' | builtin-class str | 38 |
5654
| a_simple.py:40 | ControlFlowNode for w | Tuple | builtin-class tuple | 40 |
5755
| a_simple.py:41 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 39 |
58-
| a_simple.py:41 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 41 |
5956
| a_simple.py:41 | ControlFlowNode for t | Tuple | builtin-class tuple | 39 |
6057
| a_simple.py:42 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 40 |
61-
| a_simple.py:42 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 42 |
6258
| a_simple.py:42 | ControlFlowNode for w | Tuple | builtin-class tuple | 40 |
6359
| a_simple.py:49 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 49 |
6460
| a_simple.py:49 | ControlFlowNode for b | 'b' | builtin-class str | 38 |

0 commit comments

Comments
 (0)