File tree Expand file tree Collapse file tree 4 files changed +20
-7
lines changed
lib/semmle/python/dataflow/new/internal
test/experimental/dataflow
tainttracking/generator-flow Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -254,7 +254,14 @@ abstract class LibraryCallable extends string {
254
254
}
255
255
256
256
newtype TDataFlowCallable =
257
- TFunction ( Function func ) or
257
+ TFunction ( Function func ) {
258
+ // For generators/list-comprehensions we create a synthetic function. In the
259
+ // points-to call-graph these were not considered callable, and instead we added
260
+ // data-flow steps (read/write) for these. As an easy solution for now, we do the
261
+ // same to keep things easy to reason about (and therefore exclude things that do
262
+ // not have a definition)
263
+ exists ( func .getDefinition ( ) )
264
+ } or
258
265
/** see QLDoc for `DataFlowModuleScope` for why we need this. */
259
266
TModule ( Module m ) or
260
267
TLibraryCallable ( LibraryCallable callable )
Original file line number Diff line number Diff line change 8
8
| test.py:187:1:187:53 | GSSA Variable SINK | test.py:189:5:189:8 | ControlFlowNode for SINK |
9
9
| test.py:187:1:187:53 | GSSA Variable SOURCE | test.py:188:25:188:30 | ControlFlowNode for SOURCE |
10
10
| test.py:188:5:188:5 | SSA variable x | test.py:189:10:189:10 | ControlFlowNode for x |
11
+ | test.py:188:9:188:68 | ControlFlowNode for .0 | test.py:188:9:188:68 | SSA variable .0 |
11
12
| test.py:188:9:188:68 | ControlFlowNode for ListComp | test.py:188:5:188:5 | SSA variable x |
13
+ | test.py:188:9:188:68 | SSA variable .0 | test.py:188:9:188:68 | ControlFlowNode for .0 |
14
+ | test.py:188:16:188:16 | SSA variable v | test.py:188:45:188:45 | ControlFlowNode for v |
15
+ | test.py:188:40:188:40 | SSA variable u | test.py:188:56:188:56 | ControlFlowNode for u |
16
+ | test.py:188:51:188:51 | SSA variable z | test.py:188:67:188:67 | ControlFlowNode for z |
17
+ | test.py:188:62:188:62 | SSA variable y | test.py:188:10:188:10 | ControlFlowNode for y |
Original file line number Diff line number Diff line change 15
15
| generator.py:0:0:0:0 | Module generator | generator.py:1:1:1:23 | ControlFlowNode for FunctionExpr |
16
16
| generator.py:0:0:0:0 | Module generator | generator.py:1:5:1:18 | ControlFlowNode for generator_func |
17
17
| generator.py:1:1:1:23 | Function generator_func | generator.py:1:20:1:21 | ControlFlowNode for xs |
18
+ | generator.py:1:1:1:23 | Function generator_func | generator.py:2:12:2:26 | ControlFlowNode for .0 |
19
+ | generator.py:1:1:1:23 | Function generator_func | generator.py:2:12:2:26 | ControlFlowNode for .0 |
18
20
| generator.py:1:1:1:23 | Function generator_func | generator.py:2:12:2:26 | ControlFlowNode for ListComp |
21
+ | generator.py:1:1:1:23 | Function generator_func | generator.py:2:13:2:13 | ControlFlowNode for Yield |
22
+ | generator.py:1:1:1:23 | Function generator_func | generator.py:2:13:2:13 | ControlFlowNode for x |
23
+ | generator.py:1:1:1:23 | Function generator_func | generator.py:2:19:2:19 | ControlFlowNode for x |
19
24
| generator.py:1:1:1:23 | Function generator_func | generator.py:2:24:2:25 | ControlFlowNode for xs |
20
- | generator.py:2:12:2:26 | Function listcomp | generator.py:2:12:2:26 | ControlFlowNode for .0 |
21
- | generator.py:2:12:2:26 | Function listcomp | generator.py:2:12:2:26 | ControlFlowNode for .0 |
22
- | generator.py:2:12:2:26 | Function listcomp | generator.py:2:13:2:13 | ControlFlowNode for Yield |
23
- | generator.py:2:12:2:26 | Function listcomp | generator.py:2:13:2:13 | ControlFlowNode for x |
24
- | generator.py:2:12:2:26 | Function listcomp | generator.py:2:19:2:19 | ControlFlowNode for x |
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ def test_non_source():
31
31
ensure_not_tainted (x )
32
32
33
33
x = generator_helper (NONSOURCE )
34
- ensure_not_tainted (x ) # $ SPURIOUS: tainted
34
+ ensure_not_tainted (x )
35
35
36
36
x = generator_helper_wo_source_use (NONSOURCE )
37
37
ensure_not_tainted (x )
You can’t perform that action at this time.
0 commit comments