Skip to content

Commit 1edad03

Browse files
yoffRasmusWL
andauthored
Apply suggestions from code review
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
1 parent 48910d0 commit 1edad03

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

python/ql/src/semmle/python/dataflow/new/internal/DataFlowPrivate.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ predicate subscriptReadStep(CfgNode nodeFrom, Content c, CfgNode nodeTo) {
10341034
* sequence = iterable
10351035
* ```
10361036
* where `sequence` is either a tuple or a list and it can contain wildcards.
1037-
* The iterable can be any iterable, which means that content will need to change type
1037+
* The iterable can be any iterable, which means that (CodeQL modeling of) content will need to change type
10381038
* if it should be transferred from the LHS to the RHS.
10391039
*
10401040
* We may for instance have
@@ -1046,7 +1046,7 @@ predicate subscriptReadStep(CfgNode nodeFrom, Content c, CfgNode nodeTo) {
10461046
*
10471047
* Using wildcards we may have
10481048
* ```python
1049-
* (a, *b) = ("a", "b", "tainted string") # RHS has content `TupleElement(2)`
1049+
* (a, *b) = ("a", "b", "tainted string") # RHS has content `TupleElementContent(2)`
10501050
* ```
10511051
* Since the starred variables are always assigned type list, `*b` will be
10521052
* `["b", "tainted string]`, and we will again overapproximate and assign it
@@ -1083,25 +1083,25 @@ predicate subscriptReadStep(CfgNode nodeFrom, Content c, CfgNode nodeTo) {
10831083
* 1. [Flow] Content is transferred from `iterable` to `TIterableSequence(sequence)` via a
10841084
* flow step. From here, everything happens on the LHS.
10851085
*
1086-
* 1. [Flow] Content is transferred from `TIterableSequence(sequence)` to `sequence` via a
1086+
* 2. [Flow] Content is transferred from `TIterableSequence(sequence)` to `sequence` via a
10871087
* flow step.
10881088
*
1089-
* 1. [Read] Content is read from `TIterableSequence(sequence)` into `TIterableElement(sequence)`.
1089+
* 3. [Read] Content is read from `TIterableSequence(sequence)` into `TIterableElement(sequence)`.
10901090
* If `sequence` is of type tuple, we will not read tuple content as that would allow
10911091
* cross talk.
10921092
*
1093-
* 1. [Store] Content is stored from `TIterableElement(sequence)` to `sequence`.
1093+
* 4. [Store] Content is stored from `TIterableElement(sequence)` to `sequence`.
10941094
* Here the content type is chosen according to the type of sequence.
10951095
*
1096-
* 1. [Read] Content is read from `sequence` to its elements according to the type of `sequence`.
1096+
* 5. [Read] Content is read from `sequence` to its elements according to the type of `sequence`.
10971097
* If the element is a plain variable, the target is the corresponding essa node.
10981098
* If the element is itelf a sequence, with control-flow node `seq`, the target is `TIterableSequence(seq)`.
10991099
* If the element is a starred variable, with control-flow node `v`, the target is `TIterableElement(v)`.
11001100
*
1101-
* 1. [Store] Content is stored from `TIterableElement(v)` to the essa variable for `v`, with
1101+
* 6. [Store] Content is stored from `TIterableElement(v)` to the essa variable for `v`, with
11021102
* content type `ListElement`.
11031103
*
1104-
* 1. [Flow, Read, Store] The last 5 steps are repeated for all recursive elements which are sequences.
1104+
* 7. [Flow, Read, Store] The last 5 steps are repeated for all recursive elements which are sequences.
11051105
*/
11061106
module UnpackingAssignment {
11071107
/** A direct (or top-level) target of an unpacking assignment */
@@ -1151,7 +1151,7 @@ module UnpackingAssignment {
11511151
exists(int index | exists(target.getElement(index)) |
11521152
c.(TupleElementContent).getIndex() = index
11531153
)
1154-
// leaving out dict content for now
1154+
// TODO: dict content in iterable unpacking not handled
11551155
)
11561156
)
11571157
}

0 commit comments

Comments
 (0)