@@ -207,18 +207,6 @@ private predicate fullBarrier(Node node, Configuration config) {
207
207
)
208
208
}
209
209
210
- private class AdditionalFlowStepSource extends Node {
211
- AdditionalFlowStepSource ( ) { any ( Configuration c ) .isAdditionalFlowStep ( this , _) }
212
- }
213
-
214
- pragma [ noinline]
215
- private predicate isAdditionalFlowStep (
216
- AdditionalFlowStepSource node1 , Node node2 , DataFlowCallable callable1 , Configuration config
217
- ) {
218
- config .isAdditionalFlowStep ( node1 , node2 ) and
219
- callable1 = node1 .getEnclosingCallable ( )
220
- }
221
-
222
210
/**
223
211
* Holds if data can flow in one local step from `node1` to `node2`.
224
212
*/
@@ -237,7 +225,8 @@ private predicate localFlowStep(Node node1, Node node2, Configuration config) {
237
225
* Holds if the additional step from `node1` to `node2` does not jump between callables.
238
226
*/
239
227
private predicate additionalLocalFlowStep ( Node node1 , Node node2 , Configuration config ) {
240
- isAdditionalFlowStep ( node1 , node2 , node2 .getEnclosingCallable ( ) , config ) and
228
+ config .isAdditionalFlowStep ( node1 , node2 ) and
229
+ getNodeEnclosingCallable ( node1 ) = getNodeEnclosingCallable ( node2 ) and
241
230
not outBarrier ( node1 , config ) and
242
231
not inBarrier ( node2 , config ) and
243
232
not fullBarrier ( node1 , config ) and
@@ -259,14 +248,12 @@ private predicate jumpStep(Node node1, Node node2, Configuration config) {
259
248
* Holds if the additional step from `node1` to `node2` jumps between callables.
260
249
*/
261
250
private predicate additionalJumpStep ( Node node1 , Node node2 , Configuration config ) {
262
- exists ( DataFlowCallable callable1 |
263
- isAdditionalFlowStep ( node1 , node2 , callable1 , config ) and
264
- node2 .getEnclosingCallable ( ) != callable1 and
265
- not outBarrier ( node1 , config ) and
266
- not inBarrier ( node2 , config ) and
267
- not fullBarrier ( node1 , config ) and
268
- not fullBarrier ( node2 , config )
269
- )
251
+ config .isAdditionalFlowStep ( node1 , node2 ) and
252
+ getNodeEnclosingCallable ( node1 ) != getNodeEnclosingCallable ( node2 ) and
253
+ not outBarrier ( node1 , config ) and
254
+ not inBarrier ( node2 , config ) and
255
+ not fullBarrier ( node1 , config ) and
256
+ not fullBarrier ( node2 , config )
270
257
}
271
258
272
259
/**
@@ -601,7 +588,7 @@ private module Stage1 {
601
588
) {
602
589
exists ( ReturnNodeExt ret |
603
590
throughFlowNodeCand ( ret , config ) and
604
- callable = ret . getEnclosingCallable ( ) and
591
+ callable = getNodeEnclosingCallable ( ret ) and
605
592
kind = ret .getKind ( )
606
593
)
607
594
}
@@ -614,7 +601,7 @@ private module Stage1 {
614
601
exists ( ReturnKindExt kind |
615
602
throughFlowNodeCand ( p , config ) and
616
603
returnFlowCallableNodeCand ( c , kind , config ) and
617
- p . getEnclosingCallable ( ) = c and
604
+ getNodeEnclosingCallable ( p ) = c and
618
605
exists ( ap ) and
619
606
// we don't expect a parameter to return stored in itself
620
607
not exists ( int pos |
@@ -966,7 +953,7 @@ private module Stage2 {
966
953
exists ( ArgumentNode arg , boolean allowsFieldFlow |
967
954
fwdFlow ( arg , outercc , argAp , ap , config ) and
968
955
flowIntoCall ( call , arg , p , allowsFieldFlow , config ) and
969
- innercc = getCallContextCall ( call , p . getEnclosingCallable ( ) , outercc )
956
+ innercc = getCallContextCall ( call , getNodeEnclosingCallable ( p ) , outercc )
970
957
|
971
958
ap instanceof ApNil or allowsFieldFlow = true
972
959
)
@@ -985,7 +972,7 @@ private module Stage2 {
985
972
exists ( ReturnNodeExt ret , boolean allowsFieldFlow , DataFlowCallable inner |
986
973
fwdFlow ( ret , innercc , argAp , ap , config ) and
987
974
flowOutOfCall ( call , ret , out , allowsFieldFlow , config ) and
988
- inner = ret . getEnclosingCallable ( ) and
975
+ inner = getNodeEnclosingCallable ( ret ) and
989
976
checkCallContextReturn ( innercc , inner , call ) and
990
977
ccOut = getCallContextReturn ( inner , call )
991
978
|
@@ -1216,13 +1203,13 @@ private module Stage2 {
1216
1203
ParameterNode p , Ap ap , Ap ap0 , DataFlowCallable c , Configuration config
1217
1204
) {
1218
1205
revFlow ( p , true , apSome ( ap0 ) , ap , config ) and
1219
- c = p . getEnclosingCallable ( )
1206
+ c = getNodeEnclosingCallable ( p )
1220
1207
}
1221
1208
1222
1209
predicate parameterMayFlowThrough ( ParameterNode p , DataFlowCallable c , Ap ap , Configuration config ) {
1223
1210
exists ( ReturnNodeExt ret , Ap ap0 , ReturnKindExt kind , int pos |
1224
1211
parameterFlow ( p , ap , ap0 , c , config ) and
1225
- c = ret . getEnclosingCallable ( ) and
1212
+ c = getNodeEnclosingCallable ( ret ) and
1226
1213
revFlow ( ret , true , apSome ( _) , ap0 , config ) and
1227
1214
fwdFlow ( ret , any ( CcCall ccc ) , apSome ( ap ) , ap0 , config ) and
1228
1215
kind = ret .getKind ( ) and
@@ -1348,7 +1335,7 @@ private module LocalFlowBigStep {
1348
1335
t = getNodeType ( node2 )
1349
1336
) and
1350
1337
node1 != node2 and
1351
- cc .relevantFor ( node1 . getEnclosingCallable ( ) ) and
1338
+ cc .relevantFor ( getNodeEnclosingCallable ( node1 ) ) and
1352
1339
not isUnreachableInCall ( node1 , cc .( LocalCallContextSpecificCall ) .getCall ( ) ) and
1353
1340
Stage2:: revFlow ( node2 , unbind ( config ) )
1354
1341
or
@@ -1594,7 +1581,7 @@ private module Stage3 {
1594
1581
exists ( ArgumentNode arg , boolean allowsFieldFlow |
1595
1582
fwdFlow ( arg , outercc , argAp , ap , config ) and
1596
1583
flowIntoCall ( call , arg , p , allowsFieldFlow , config ) and
1597
- innercc = getCallContextCall ( call , p . getEnclosingCallable ( ) , outercc )
1584
+ innercc = getCallContextCall ( call , getNodeEnclosingCallable ( p ) , outercc )
1598
1585
|
1599
1586
ap instanceof ApNil or allowsFieldFlow = true
1600
1587
)
@@ -1613,7 +1600,7 @@ private module Stage3 {
1613
1600
exists ( ReturnNodeExt ret , boolean allowsFieldFlow , DataFlowCallable inner |
1614
1601
fwdFlow ( ret , innercc , argAp , ap , config ) and
1615
1602
flowOutOfCall ( call , ret , out , allowsFieldFlow , config ) and
1616
- inner = ret . getEnclosingCallable ( ) and
1603
+ inner = getNodeEnclosingCallable ( ret ) and
1617
1604
checkCallContextReturn ( innercc , inner , call ) and
1618
1605
ccOut = getCallContextReturn ( inner , call )
1619
1606
|
@@ -1844,13 +1831,13 @@ private module Stage3 {
1844
1831
ParameterNode p , Ap ap , Ap ap0 , DataFlowCallable c , Configuration config
1845
1832
) {
1846
1833
revFlow ( p , true , apSome ( ap0 ) , ap , config ) and
1847
- c = p . getEnclosingCallable ( )
1834
+ c = getNodeEnclosingCallable ( p )
1848
1835
}
1849
1836
1850
1837
predicate parameterMayFlowThrough ( ParameterNode p , DataFlowCallable c , Ap ap , Configuration config ) {
1851
1838
exists ( ReturnNodeExt ret , Ap ap0 , ReturnKindExt kind , int pos |
1852
1839
parameterFlow ( p , ap , ap0 , c , config ) and
1853
- c = ret . getEnclosingCallable ( ) and
1840
+ c = getNodeEnclosingCallable ( ret ) and
1854
1841
revFlow ( ret , true , apSome ( _) , ap0 , config ) and
1855
1842
fwdFlow ( ret , any ( CcCall ccc ) , apSome ( ap ) , ap0 , config ) and
1856
1843
kind = ret .getKind ( ) and
@@ -2135,7 +2122,7 @@ private module Stage4 {
2135
2122
bindingset [ node, cc, config]
2136
2123
private LocalCc getLocalCc ( Node node , Cc cc , Configuration config ) {
2137
2124
localFlowEntry ( node , config ) and
2138
- result = getLocalCallContext ( cc , node . getEnclosingCallable ( ) )
2125
+ result = getLocalCallContext ( cc , getNodeEnclosingCallable ( node ) )
2139
2126
}
2140
2127
2141
2128
private predicate localStep (
@@ -2300,7 +2287,7 @@ private module Stage4 {
2300
2287
exists ( ArgumentNode arg , boolean allowsFieldFlow |
2301
2288
fwdFlow ( arg , outercc , argAp , ap , config ) and
2302
2289
flowIntoCall ( call , arg , p , allowsFieldFlow , config ) and
2303
- innercc = getCallContextCall ( call , p . getEnclosingCallable ( ) , outercc )
2290
+ innercc = getCallContextCall ( call , getNodeEnclosingCallable ( p ) , outercc )
2304
2291
|
2305
2292
ap instanceof ApNil or allowsFieldFlow = true
2306
2293
)
@@ -2319,7 +2306,7 @@ private module Stage4 {
2319
2306
exists ( ReturnNodeExt ret , boolean allowsFieldFlow , DataFlowCallable inner |
2320
2307
fwdFlow ( ret , innercc , argAp , ap , config ) and
2321
2308
flowOutOfCall ( call , ret , out , allowsFieldFlow , config ) and
2322
- inner = ret . getEnclosingCallable ( ) and
2309
+ inner = getNodeEnclosingCallable ( ret ) and
2323
2310
checkCallContextReturn ( innercc , inner , call ) and
2324
2311
ccOut = getCallContextReturn ( inner , call )
2325
2312
|
@@ -2550,13 +2537,13 @@ private module Stage4 {
2550
2537
ParameterNode p , Ap ap , Ap ap0 , DataFlowCallable c , Configuration config
2551
2538
) {
2552
2539
revFlow ( p , true , apSome ( ap0 ) , ap , config ) and
2553
- c = p . getEnclosingCallable ( )
2540
+ c = getNodeEnclosingCallable ( p )
2554
2541
}
2555
2542
2556
2543
predicate parameterMayFlowThrough ( ParameterNode p , DataFlowCallable c , Ap ap , Configuration config ) {
2557
2544
exists ( ReturnNodeExt ret , Ap ap0 , ReturnKindExt kind , int pos |
2558
2545
parameterFlow ( p , ap , ap0 , c , config ) and
2559
- c = ret . getEnclosingCallable ( ) and
2546
+ c = getNodeEnclosingCallable ( ret ) and
2560
2547
revFlow ( ret , true , apSome ( _) , ap0 , config ) and
2561
2548
fwdFlow ( ret , any ( CcCall ccc ) , apSome ( ap ) , ap0 , config ) and
2562
2549
kind = ret .getKind ( ) and
@@ -2590,7 +2577,7 @@ private predicate nodeMayUseSummary(Node n, AccessPathApprox apa, Configuration
2590
2577
Stage4:: parameterMayFlowThrough ( _, c , apa , _) and
2591
2578
Stage4:: revFlow ( n , true , _, apa0 , config ) and
2592
2579
Stage4:: fwdFlow ( n , any ( CallContextCall ccc ) , TAccessPathApproxSome ( apa ) , apa0 , config ) and
2593
- n . getEnclosingCallable ( ) = c
2580
+ getNodeEnclosingCallable ( n ) = c
2594
2581
)
2595
2582
}
2596
2583
@@ -3119,7 +3106,7 @@ private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, SummaryCt
3119
3106
conf = mid .getConfiguration ( ) and
3120
3107
cc = mid .getCallContext ( ) and
3121
3108
sc = mid .getSummaryCtx ( ) and
3122
- localCC = getLocalCallContext ( cc , midnode . getEnclosingCallable ( ) ) and
3109
+ localCC = getLocalCallContext ( cc , getNodeEnclosingCallable ( midnode ) ) and
3123
3110
ap0 = mid .getAp ( )
3124
3111
|
3125
3112
localFlowBigStep ( midnode , node , true , _, conf , localCC ) and
@@ -3405,22 +3392,22 @@ private module FlowExploration {
3405
3392
// flow out of a callable
3406
3393
viableReturnPosOut ( _, getReturnPosition ( node1 ) , node2 )
3407
3394
|
3408
- c1 = node1 . getEnclosingCallable ( ) and
3409
- c2 = node2 . getEnclosingCallable ( ) and
3395
+ c1 = getNodeEnclosingCallable ( node1 ) and
3396
+ c2 = getNodeEnclosingCallable ( node2 ) and
3410
3397
c1 != c2
3411
3398
)
3412
3399
}
3413
3400
3414
3401
private predicate interestingCallableSrc ( DataFlowCallable c , Configuration config ) {
3415
- exists ( Node n | config .isSource ( n ) and c = n . getEnclosingCallable ( ) )
3402
+ exists ( Node n | config .isSource ( n ) and c = getNodeEnclosingCallable ( n ) )
3416
3403
or
3417
3404
exists ( DataFlowCallable mid |
3418
3405
interestingCallableSrc ( mid , config ) and callableStep ( mid , c , config )
3419
3406
)
3420
3407
}
3421
3408
3422
3409
private predicate interestingCallableSink ( DataFlowCallable c , Configuration config ) {
3423
- exists ( Node n | config .isSink ( n ) and c = n . getEnclosingCallable ( ) )
3410
+ exists ( Node n | config .isSink ( n ) and c = getNodeEnclosingCallable ( n ) )
3424
3411
or
3425
3412
exists ( DataFlowCallable mid |
3426
3413
interestingCallableSink ( mid , config ) and callableStep ( c , mid , config )
@@ -3449,13 +3436,13 @@ private module FlowExploration {
3449
3436
exists ( Node n , Configuration config |
3450
3437
ce1 = TCallableSrc ( ) and
3451
3438
config .isSource ( n ) and
3452
- ce2 = TCallable ( n . getEnclosingCallable ( ) , config )
3439
+ ce2 = TCallable ( getNodeEnclosingCallable ( n ) , config )
3453
3440
)
3454
3441
or
3455
3442
exists ( Node n , Configuration config |
3456
3443
ce2 = TCallableSink ( ) and
3457
3444
config .isSink ( n ) and
3458
- ce1 = TCallable ( n . getEnclosingCallable ( ) , config )
3445
+ ce1 = TCallable ( getNodeEnclosingCallable ( n ) , config )
3459
3446
)
3460
3447
}
3461
3448
@@ -3586,7 +3573,7 @@ private module FlowExploration {
3586
3573
exists ( config .explorationLimit ( ) )
3587
3574
or
3588
3575
partialPathNodeMk0 ( node , cc , sc1 , sc2 , ap , config ) and
3589
- distSrc ( node . getEnclosingCallable ( ) , config ) <= config .explorationLimit ( )
3576
+ distSrc ( getNodeEnclosingCallable ( node ) , config ) <= config .explorationLimit ( )
3590
3577
} or
3591
3578
TPartialPathNodeRev (
3592
3579
Node node , TRevSummaryCtx1 sc1 , TRevSummaryCtx2 sc2 , RevPartialAccessPath ap ,
@@ -3603,7 +3590,7 @@ private module FlowExploration {
3603
3590
revPartialPathStep ( mid , node , sc1 , sc2 , ap , config ) and
3604
3591
not clearsContent ( node , ap .getHead ( ) ) and
3605
3592
not fullBarrier ( node , config ) and
3606
- distSink ( node . getEnclosingCallable ( ) , config ) <= config .explorationLimit ( )
3593
+ distSink ( getNodeEnclosingCallable ( node ) , config ) <= config .explorationLimit ( )
3607
3594
)
3608
3595
}
3609
3596
@@ -3662,15 +3649,15 @@ private module FlowExploration {
3662
3649
* of interprocedural steps.
3663
3650
*/
3664
3651
int getSourceDistance ( ) {
3665
- result = distSrc ( this .getNode ( ) . getEnclosingCallable ( ) , this .getConfiguration ( ) )
3652
+ result = distSrc ( getNodeEnclosingCallable ( this .getNode ( ) ) , this .getConfiguration ( ) )
3666
3653
}
3667
3654
3668
3655
/**
3669
3656
* Gets the approximate distance to the nearest sink measured in number
3670
3657
* of interprocedural steps.
3671
3658
*/
3672
3659
int getSinkDistance ( ) {
3673
- result = distSink ( this .getNode ( ) . getEnclosingCallable ( ) , this .getConfiguration ( ) )
3660
+ result = distSink ( getNodeEnclosingCallable ( this .getNode ( ) ) , this .getConfiguration ( ) )
3674
3661
}
3675
3662
3676
3663
private string ppAp ( ) {
0 commit comments