@@ -256,11 +256,11 @@ private class ArgNodeEx extends NodeEx {
256
256
private class ParamNodeEx extends NodeEx {
257
257
ParamNodeEx ( ) { this .asNode ( ) instanceof ParamNode }
258
258
259
- predicate isParameterOf ( DataFlowCallable c , int i ) {
260
- this .asNode ( ) .( ParamNode ) .isParameterOf ( c , i )
259
+ predicate isParameterOf ( DataFlowCallable c , ParameterPosition pos ) {
260
+ this .asNode ( ) .( ParamNode ) .isParameterOf ( c , pos )
261
261
}
262
262
263
- int getPosition ( ) { this .isParameterOf ( _, result ) }
263
+ ParameterPosition getPosition ( ) { this .isParameterOf ( _, result ) }
264
264
265
265
predicate allowParameterReturnInSelf ( ) { allowParameterReturnInSelfCached ( this .asNode ( ) ) }
266
266
}
@@ -1430,7 +1430,7 @@ private module Stage2 {
1430
1430
}
1431
1431
1432
1432
predicate parameterMayFlowThrough ( ParamNodeEx p , DataFlowCallable c , Ap ap , Configuration config ) {
1433
- exists ( RetNodeEx ret , Ap ap0 , ReturnKindExt kind , int pos |
1433
+ exists ( RetNodeEx ret , Ap ap0 , ReturnKindExt kind , ParameterPosition pos |
1434
1434
parameterFlow ( p , ap , ap0 , c , config ) and
1435
1435
c = ret .getEnclosingCallable ( ) and
1436
1436
revFlow ( pragma [ only_bind_into ] ( ret ) , true , apSome ( _) , pragma [ only_bind_into ] ( ap0 ) ,
@@ -2125,7 +2125,7 @@ private module Stage3 {
2125
2125
}
2126
2126
2127
2127
predicate parameterMayFlowThrough ( ParamNodeEx p , DataFlowCallable c , Ap ap , Configuration config ) {
2128
- exists ( RetNodeEx ret , Ap ap0 , ReturnKindExt kind , int pos |
2128
+ exists ( RetNodeEx ret , Ap ap0 , ReturnKindExt kind , ParameterPosition pos |
2129
2129
parameterFlow ( p , ap , ap0 , c , config ) and
2130
2130
c = ret .getEnclosingCallable ( ) and
2131
2131
revFlow ( pragma [ only_bind_into ] ( ret ) , true , apSome ( _) , pragma [ only_bind_into ] ( ap0 ) ,
@@ -2891,7 +2891,7 @@ private module Stage4 {
2891
2891
}
2892
2892
2893
2893
predicate parameterMayFlowThrough ( ParamNodeEx p , DataFlowCallable c , Ap ap , Configuration config ) {
2894
- exists ( RetNodeEx ret , Ap ap0 , ReturnKindExt kind , int pos |
2894
+ exists ( RetNodeEx ret , Ap ap0 , ReturnKindExt kind , ParameterPosition pos |
2895
2895
parameterFlow ( p , ap , ap0 , c , config ) and
2896
2896
c = ret .getEnclosingCallable ( ) and
2897
2897
revFlow ( pragma [ only_bind_into ] ( ret ) , true , apSome ( _) , pragma [ only_bind_into ] ( ap0 ) ,
@@ -2975,7 +2975,7 @@ private class SummaryCtxSome extends SummaryCtx, TSummaryCtxSome {
2975
2975
2976
2976
SummaryCtxSome ( ) { this = TSummaryCtxSome ( p , ap ) }
2977
2977
2978
- int getParameterPos ( ) { p .isParameterOf ( _, result ) }
2978
+ ParameterPosition getParameterPos ( ) { p .isParameterOf ( _, result ) }
2979
2979
2980
2980
ParamNodeEx getParamNode ( ) { result = p }
2981
2981
@@ -3622,39 +3622,40 @@ private predicate pathOutOfCallable(PathNodeMid mid, NodeEx out, CallContext cc)
3622
3622
*/
3623
3623
pragma [ noinline]
3624
3624
private predicate pathIntoArg (
3625
- PathNodeMid mid , int i , CallContext cc , DataFlowCall call , AccessPath ap , AccessPathApprox apa ,
3626
- Configuration config
3625
+ PathNodeMid mid , ParameterPosition ppos , CallContext cc , DataFlowCall call , AccessPath ap ,
3626
+ AccessPathApprox apa , Configuration config
3627
3627
) {
3628
- exists ( ArgNode arg |
3628
+ exists ( ArgNode arg , ArgumentPosition apos |
3629
3629
arg = mid .getNodeEx ( ) .asNode ( ) and
3630
3630
cc = mid .getCallContext ( ) and
3631
- arg .argumentOf ( call , i ) and
3631
+ arg .argumentOf ( call , apos ) and
3632
3632
ap = mid .getAp ( ) and
3633
3633
apa = ap .getApprox ( ) and
3634
- config = mid .getConfiguration ( )
3634
+ config = mid .getConfiguration ( ) and
3635
+ parameterMatch ( ppos , apos )
3635
3636
)
3636
3637
}
3637
3638
3638
3639
pragma [ nomagic]
3639
3640
private predicate parameterCand (
3640
- DataFlowCallable callable , int i , AccessPathApprox apa , Configuration config
3641
+ DataFlowCallable callable , ParameterPosition pos , AccessPathApprox apa , Configuration config
3641
3642
) {
3642
3643
exists ( ParamNodeEx p |
3643
3644
Stage4:: revFlow ( p , _, _, apa , config ) and
3644
- p .isParameterOf ( callable , i )
3645
+ p .isParameterOf ( callable , pos )
3645
3646
)
3646
3647
}
3647
3648
3648
3649
pragma [ nomagic]
3649
3650
private predicate pathIntoCallable0 (
3650
- PathNodeMid mid , DataFlowCallable callable , int i , CallContext outercc , DataFlowCall call ,
3651
- AccessPath ap , Configuration config
3651
+ PathNodeMid mid , DataFlowCallable callable , ParameterPosition pos , CallContext outercc ,
3652
+ DataFlowCall call , AccessPath ap , Configuration config
3652
3653
) {
3653
3654
exists ( AccessPathApprox apa |
3654
- pathIntoArg ( mid , pragma [ only_bind_into ] ( i ) , outercc , call , ap , pragma [ only_bind_into ] ( apa ) ,
3655
+ pathIntoArg ( mid , pragma [ only_bind_into ] ( pos ) , outercc , call , ap , pragma [ only_bind_into ] ( apa ) ,
3655
3656
pragma [ only_bind_into ] ( config ) ) and
3656
3657
callable = resolveCall ( call , outercc ) and
3657
- parameterCand ( callable , pragma [ only_bind_into ] ( i ) , pragma [ only_bind_into ] ( apa ) ,
3658
+ parameterCand ( callable , pragma [ only_bind_into ] ( pos ) , pragma [ only_bind_into ] ( apa ) ,
3658
3659
pragma [ only_bind_into ] ( config ) )
3659
3660
)
3660
3661
}
@@ -3669,9 +3670,9 @@ private predicate pathIntoCallable(
3669
3670
PathNodeMid mid , ParamNodeEx p , CallContext outercc , CallContextCall innercc , SummaryCtx sc ,
3670
3671
DataFlowCall call , Configuration config
3671
3672
) {
3672
- exists ( int i , DataFlowCallable callable , AccessPath ap |
3673
- pathIntoCallable0 ( mid , callable , i , outercc , call , ap , config ) and
3674
- p .isParameterOf ( callable , i ) and
3673
+ exists ( ParameterPosition pos , DataFlowCallable callable , AccessPath ap |
3674
+ pathIntoCallable0 ( mid , callable , pos , outercc , call , ap , config ) and
3675
+ p .isParameterOf ( callable , pos ) and
3675
3676
(
3676
3677
sc = TSummaryCtxSome ( p , ap )
3677
3678
or
@@ -3695,7 +3696,7 @@ private predicate paramFlowsThrough(
3695
3696
ReturnKindExt kind , CallContextCall cc , SummaryCtxSome sc , AccessPath ap , AccessPathApprox apa ,
3696
3697
Configuration config
3697
3698
) {
3698
- exists ( PathNodeMid mid , RetNodeEx ret , int pos |
3699
+ exists ( PathNodeMid mid , RetNodeEx ret , ParameterPosition pos |
3699
3700
mid .getNodeEx ( ) = ret and
3700
3701
kind = ret .getKind ( ) and
3701
3702
cc = mid .getCallContext ( ) and
@@ -4424,24 +4425,25 @@ private module FlowExploration {
4424
4425
4425
4426
pragma [ noinline]
4426
4427
private predicate partialPathIntoArg (
4427
- PartialPathNodeFwd mid , int i , CallContext cc , DataFlowCall call , PartialAccessPath ap ,
4428
- Configuration config
4428
+ PartialPathNodeFwd mid , ParameterPosition ppos , CallContext cc , DataFlowCall call ,
4429
+ PartialAccessPath ap , Configuration config
4429
4430
) {
4430
- exists ( ArgNode arg |
4431
+ exists ( ArgNode arg , ArgumentPosition apos |
4431
4432
arg = mid .getNodeEx ( ) .asNode ( ) and
4432
4433
cc = mid .getCallContext ( ) and
4433
- arg .argumentOf ( call , i ) and
4434
+ arg .argumentOf ( call , apos ) and
4434
4435
ap = mid .getAp ( ) and
4435
- config = mid .getConfiguration ( )
4436
+ config = mid .getConfiguration ( ) and
4437
+ parameterMatch ( ppos , apos )
4436
4438
)
4437
4439
}
4438
4440
4439
4441
pragma [ nomagic]
4440
4442
private predicate partialPathIntoCallable0 (
4441
- PartialPathNodeFwd mid , DataFlowCallable callable , int i , CallContext outercc ,
4443
+ PartialPathNodeFwd mid , DataFlowCallable callable , ParameterPosition pos , CallContext outercc ,
4442
4444
DataFlowCall call , PartialAccessPath ap , Configuration config
4443
4445
) {
4444
- partialPathIntoArg ( mid , i , outercc , call , ap , config ) and
4446
+ partialPathIntoArg ( mid , pos , outercc , call , ap , config ) and
4445
4447
callable = resolveCall ( call , outercc )
4446
4448
}
4447
4449
@@ -4450,9 +4452,9 @@ private module FlowExploration {
4450
4452
TSummaryCtx1 sc1 , TSummaryCtx2 sc2 , DataFlowCall call , PartialAccessPath ap ,
4451
4453
Configuration config
4452
4454
) {
4453
- exists ( int i , DataFlowCallable callable |
4454
- partialPathIntoCallable0 ( mid , callable , i , outercc , call , ap , config ) and
4455
- p .isParameterOf ( callable , i ) and
4455
+ exists ( ParameterPosition pos , DataFlowCallable callable |
4456
+ partialPathIntoCallable0 ( mid , callable , pos , outercc , call , ap , config ) and
4457
+ p .isParameterOf ( callable , pos ) and
4456
4458
sc1 = TSummaryCtx1Param ( p ) and
4457
4459
sc2 = TSummaryCtx2Some ( ap )
4458
4460
|
@@ -4616,22 +4618,23 @@ private module FlowExploration {
4616
4618
4617
4619
pragma [ nomagic]
4618
4620
private predicate revPartialPathFlowsThrough (
4619
- int pos , TRevSummaryCtx1Some sc1 , TRevSummaryCtx2Some sc2 , RevPartialAccessPath ap ,
4620
- Configuration config
4621
+ ArgumentPosition apos , TRevSummaryCtx1Some sc1 , TRevSummaryCtx2Some sc2 ,
4622
+ RevPartialAccessPath ap , Configuration config
4621
4623
) {
4622
- exists ( PartialPathNodeRev mid , ParamNodeEx p |
4624
+ exists ( PartialPathNodeRev mid , ParamNodeEx p , ParameterPosition ppos |
4623
4625
mid .getNodeEx ( ) = p and
4624
- p .getPosition ( ) = pos and
4626
+ p .getPosition ( ) = ppos and
4625
4627
sc1 = mid .getSummaryCtx1 ( ) and
4626
4628
sc2 = mid .getSummaryCtx2 ( ) and
4627
4629
ap = mid .getAp ( ) and
4628
- config = mid .getConfiguration ( )
4630
+ config = mid .getConfiguration ( ) and
4631
+ parameterMatch ( ppos , apos )
4629
4632
)
4630
4633
}
4631
4634
4632
4635
pragma [ nomagic]
4633
4636
private predicate revPartialPathThroughCallable0 (
4634
- DataFlowCall call , PartialPathNodeRev mid , int pos , RevPartialAccessPath ap ,
4637
+ DataFlowCall call , PartialPathNodeRev mid , ArgumentPosition pos , RevPartialAccessPath ap ,
4635
4638
Configuration config
4636
4639
) {
4637
4640
exists ( TRevSummaryCtx1Some sc1 , TRevSummaryCtx2Some sc2 |
@@ -4644,7 +4647,7 @@ private module FlowExploration {
4644
4647
private predicate revPartialPathThroughCallable (
4645
4648
PartialPathNodeRev mid , ArgNodeEx node , RevPartialAccessPath ap , Configuration config
4646
4649
) {
4647
- exists ( DataFlowCall call , int pos |
4650
+ exists ( DataFlowCall call , ArgumentPosition pos |
4648
4651
revPartialPathThroughCallable0 ( call , mid , pos , ap , config ) and
4649
4652
node .asNode ( ) .( ArgNode ) .argumentOf ( call , pos )
4650
4653
)
0 commit comments