@@ -876,7 +876,7 @@ private module TrackAttrReadInput implements CallGraphConstruction::Simple::Inpu
876
876
877
877
predicate start ( Node start , AttrRead attr ) {
878
878
start = attr and
879
- attr .getObject ( ) in [
879
+ pragma [ only_bind_into ] ( attr .getObject ( ) ) in [
880
880
classTracker ( _) , classInstanceTracker ( _) , selfTracker ( _) , clsArgumentTracker ( _) ,
881
881
superCallNoArgumentTracker ( _) , superCallTwoArgumentTracker ( _, _)
882
882
]
@@ -1302,19 +1302,15 @@ predicate getCallArg(CallNode call, Function target, CallType type, Node arg, Ar
1302
1302
//
1303
1303
// call_func(my_obj.some_method)
1304
1304
// ```
1305
- exists ( CfgNode cfgNode | cfgNode .getNode ( ) = call |
1306
- cfgNode .getEnclosingCallable ( ) = arg .getEnclosingCallable ( )
1307
- )
1305
+ exists ( CfgNode cfgNode | cfgNode .getNode ( ) = call | sameEnclosingCallable ( cfgNode , arg ) )
1308
1306
or
1309
1307
// cls argument for classmethod calls -- see note above about bound methods
1310
1308
type instanceof CallTypeClassMethod and
1311
1309
apos .isSelf ( ) and
1312
1310
resolveMethodCall ( call , target , type , arg ) and
1313
1311
( arg = classTracker ( _) or arg = clsArgumentTracker ( _) ) and
1314
1312
// dataflow lib has requirement that arguments and calls are in same enclosing callable.
1315
- exists ( CfgNode cfgNode | cfgNode .getNode ( ) = call |
1316
- cfgNode .getEnclosingCallable ( ) = arg .getEnclosingCallable ( )
1317
- )
1313
+ exists ( CfgNode cfgNode | cfgNode .getNode ( ) = call | sameEnclosingCallable ( cfgNode , arg ) )
1318
1314
or
1319
1315
// normal arguments for method calls
1320
1316
(
@@ -1365,6 +1361,16 @@ predicate getCallArg(CallNode call, Function target, CallType type, Node arg, Ar
1365
1361
)
1366
1362
}
1367
1363
1364
+ /**
1365
+ * join-order helper for getCallArg, since otherwise we would do cartesian product of
1366
+ * the enclosing callables
1367
+ */
1368
+ bindingset [ node1, node2]
1369
+ pragma [ inline_late]
1370
+ private predicate sameEnclosingCallable ( Node node1 , Node node2 ) {
1371
+ node1 .getEnclosingCallable ( ) = node2 .getEnclosingCallable ( )
1372
+ }
1373
+
1368
1374
// =============================================================================
1369
1375
// DataFlowCall
1370
1376
// =============================================================================
0 commit comments