File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
python/ql/lib/semmle/python/dataflow/new/internal Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,11 @@ class LocalSourceNode extends Node {
101
101
*/
102
102
Node getAnAwaited ( ) { Cached:: await ( this , result ) }
103
103
104
+ /**
105
+ * Gets a subscript of this node.
106
+ */
107
+ CfgNode getASubscript ( ) { Cached:: subscript ( this , result ) }
108
+
104
109
/**
105
110
* Gets a call to the method `methodName` on this node.
106
111
*
@@ -233,7 +238,7 @@ private module Cached {
233
238
}
234
239
235
240
/**
236
- * Holds if `node` flows to the awaited value of `awaited`.
241
+ * Holds if `node` flows to a value that, when awaited, results in `awaited`.
237
242
*/
238
243
cached
239
244
predicate await ( LocalSourceNode node , Node awaited ) {
@@ -242,4 +247,15 @@ private module Cached {
242
247
awaited = awaited ( awaitedValue )
243
248
)
244
249
}
250
+
251
+ /**
252
+ * Holds if `node` flows to a sequence of which `subscript` is a subscript.
253
+ */
254
+ cached
255
+ predicate subscript ( LocalSourceNode node , CfgNode subscript ) {
256
+ exists ( CfgNode seq , SubscriptNode subscriptNode | subscriptNode = subscript .getNode ( ) |
257
+ node .flowsTo ( seq ) and
258
+ seq .getNode ( ) = subscriptNode .getObject ( )
259
+ )
260
+ }
245
261
}
You can’t perform that action at this time.
0 commit comments