@@ -190,6 +190,8 @@ module MakeImpl<InputSig Lang> {
190190
191191 private class ArgNodeEx extends NodeEx {
192192 ArgNodeEx ( ) { this .asNode ( ) instanceof ArgNode }
193+
194+ DataFlowCall getCall ( ) { this .asNode ( ) .( ArgNode ) .argumentOf ( result , _) }
193195 }
194196
195197 private class ParamNodeEx extends NodeEx {
@@ -1155,7 +1157,6 @@ module MakeImpl<InputSig Lang> {
11551157
11561158 DataFlowCallable viableImplCallContextReducedReverse ( DataFlowCall call , CcNoCall ctx ) ;
11571159
1158- bindingset [ ctx]
11591160 predicate viableImplNotCallContextReducedReverse ( CcNoCall ctx ) ;
11601161
11611162 bindingset [ call, c]
@@ -1201,7 +1202,7 @@ module MakeImpl<InputSig Lang> {
12011202
12021203 pragma [ nomagic]
12031204 private predicate flowIntoCallApa (
1204- DataFlowCall call , ArgNodeEx arg , ParamNodeEx p , DataFlowCallable c ,
1205+ DataFlowCall call , DataFlowCallable c , ArgNodeEx arg , ParamNodeEx p ,
12051206 boolean allowsFieldFlow , ApApprox apa
12061207 ) {
12071208 flowIntoCall ( call , arg , p , allowsFieldFlow ) and
@@ -1212,7 +1213,7 @@ module MakeImpl<InputSig Lang> {
12121213
12131214 pragma [ nomagic]
12141215 private predicate flowOutOfCallApa (
1215- DataFlowCall call , RetNodeEx ret , DataFlowCallable c , ReturnKindExt kind , NodeEx out ,
1216+ DataFlowCall call , DataFlowCallable c , RetNodeEx ret , ReturnKindExt kind , NodeEx out ,
12161217 boolean allowsFieldFlow , ApApprox apa
12171218 ) {
12181219 flowOutOfCall ( call , ret , kind , out , allowsFieldFlow ) and
@@ -1227,7 +1228,7 @@ module MakeImpl<InputSig Lang> {
12271228 ApApprox argApa , ApApprox apa
12281229 ) {
12291230 exists ( ReturnKindExt kind |
1230- flowOutOfCallApa ( call , ret , _ , kind , out , allowsFieldFlow , apa ) and
1231+ flowOutOfCallApa ( call , _ , ret , kind , out , allowsFieldFlow , apa ) and
12311232 PrevStage:: callMayFlowThroughRev ( call ) and
12321233 PrevStage:: returnMayFlowThrough ( ret , argApa , apa , kind ) and
12331234 matchesCall ( ccc , call )
@@ -1413,31 +1414,30 @@ module MakeImpl<InputSig Lang> {
14131414 }
14141415
14151416 pragma [ nomagic]
1416- private predicate fwdFlowIn0 (
1417- DataFlowCall call , ArgNodeEx arg , FlowState state , Cc outercc , ParamNodeOption summaryCtx ,
1418- TypOption argT , ApOption argAp , Typ t , Ap ap , ApApprox apa
1417+ private predicate flowIntoCallApaCallContextReduced (
1418+ DataFlowCall call , DataFlowCallable c , ArgNodeEx arg , ParamNodeEx p ,
1419+ boolean allowsFieldFlow , ApApprox apa , CcCall outercc
14191420 ) {
1420- fwdFlow ( arg , state , outercc , summaryCtx , argT , argAp , t , ap , apa ) and
1421- flowIntoCallApa ( call , arg , _ , _ , _ , _ )
1421+ c = viableImplCallContextReduced ( call , outercc ) and
1422+ flowIntoCallApa ( call , c , arg , p , allowsFieldFlow , apa )
14221423 }
14231424
1424- pragma [ nomagic]
1425- private predicate fwdFlowInCallContextReduced (
1426- DataFlowCall call , ArgNodeEx arg , FlowState state , CcCall outercc ,
1427- ParamNodeOption summaryCtx , TypOption argT , ApOption argAp , Typ t , Ap ap , ApApprox apa ,
1428- DataFlowCallable inner
1425+ bindingset [ arg, outercc]
1426+ pragma [ inline_late]
1427+ private predicate viableImplArgNotCallContextReduced (
1428+ DataFlowCall call , ArgNodeEx arg , Cc outercc
14291429 ) {
1430- fwdFlowIn0 ( call , arg , state , outercc , summaryCtx , argT , argAp , t , ap , apa ) and
1431- inner = viableImplCallContextReduced ( call , outercc )
1430+ call = arg . getCall ( ) and
1431+ viableImplNotCallContextReduced ( call , outercc )
14321432 }
14331433
1434- pragma [ nomagic]
1435- private predicate fwdFlowInNotCallContextReduced (
1436- DataFlowCall call , ArgNodeEx arg , FlowState state , Cc outercc , ParamNodeOption summaryCtx ,
1437- TypOption argT , ApOption argAp , Typ t , Ap ap , ApApprox apa
1434+ bindingset [ call]
1435+ pragma [ inline_late]
1436+ private predicate flowIntoCallApaInlineLate (
1437+ DataFlowCall call , DataFlowCallable c , ArgNodeEx arg , ParamNodeEx p ,
1438+ boolean allowsFieldFlow , ApApprox apa
14381439 ) {
1439- fwdFlowIn0 ( call , arg , state , outercc , summaryCtx , argT , argAp , t , ap , apa ) and
1440- viableImplNotCallContextReduced ( call , outercc )
1440+ flowIntoCallApa ( call , c , arg , p , allowsFieldFlow , apa )
14411441 }
14421442
14431443 pragma [ nomagic]
@@ -1446,44 +1446,37 @@ module MakeImpl<InputSig Lang> {
14461446 ParamNodeOption summaryCtx , TypOption argT , ApOption argAp , Typ t , Ap ap , ApApprox apa
14471447 ) {
14481448 exists ( ArgNodeEx arg , boolean allowsFieldFlow , DataFlowCallable inner |
1449- fwdFlowInCallContextReduced ( call , arg , state , outercc , summaryCtx , argT , argAp , t , ap ,
1450- apa , inner )
1451- or
1452- fwdFlowInNotCallContextReduced ( call , arg , state , outercc , summaryCtx , argT , argAp , t ,
1453- ap , apa )
1449+ fwdFlow ( arg , state , outercc , summaryCtx , argT , argAp , t , ap , apa ) and
1450+ (
1451+ flowIntoCallApaCallContextReduced ( call , inner , arg , p , allowsFieldFlow , apa , outercc )
1452+ or
1453+ viableImplArgNotCallContextReduced ( call , arg , outercc ) and
1454+ flowIntoCallApaInlineLate ( call , inner , arg , p , allowsFieldFlow , apa )
1455+ )
14541456 |
1455- flowIntoCallApa ( call , arg , p , inner , allowsFieldFlow , apa ) and
14561457 innercc = getCallContextCall ( call , inner ) and
14571458 if allowsFieldFlow = false then ap instanceof ApNil else any ( )
14581459 )
14591460 }
14601461
14611462 pragma [ nomagic]
1462- private predicate fwdFlowOut0 (
1463- RetNodeEx ret , FlowState state , CcNoCall innercc , ParamNodeOption summaryCtx ,
1464- TypOption argT , ApOption argAp , Typ t , Ap ap , ApApprox apa , DataFlowCallable inner
1465- ) {
1466- fwdFlow ( ret , state , innercc , summaryCtx , argT , argAp , t , ap , apa ) and
1467- inner = ret .getEnclosingCallable ( )
1468- }
1469-
1470- pragma [ nomagic]
1471- private predicate fwdFlowOutCallContextReduced (
1472- DataFlowCall call , RetNodeEx ret , FlowState state , CcNoCall innercc ,
1473- ParamNodeOption summaryCtx , TypOption argT , ApOption argAp , Typ t , Ap ap , ApApprox apa ,
1474- DataFlowCallable inner
1463+ private predicate flowOutOfCallApaCallContextReduced (
1464+ DataFlowCall call , DataFlowCallable c , RetNodeEx ret , NodeEx out , boolean allowsFieldFlow ,
1465+ ApApprox apa , CcNoCall innercc
14751466 ) {
1476- fwdFlowOut0 ( ret , state , innercc , summaryCtx , argT , argAp , t , ap , apa , inner ) and
1477- inner = viableImplCallContextReducedReverse ( call , innercc )
1467+ flowOutOfCallApa ( call , c , ret , _ , out , allowsFieldFlow , apa ) and
1468+ c = viableImplCallContextReducedReverse ( call , innercc )
14781469 }
14791470
1480- pragma [ nomagic]
1481- private predicate fwdFlowOutNotCallContextReduced (
1482- RetNodeEx ret , FlowState state , CcNoCall innercc , ParamNodeOption summaryCtx ,
1483- TypOption argT , ApOption argAp , Typ t , Ap ap , ApApprox apa , DataFlowCallable inner
1471+ bindingset [ ret, apa, innercc]
1472+ pragma [ inline_late]
1473+ pragma [ noopt]
1474+ private predicate flowOutOfCallApaNotCallContextReduced (
1475+ DataFlowCall call , DataFlowCallable c , RetNodeEx ret , NodeEx out , boolean allowsFieldFlow ,
1476+ ApApprox apa , CcNoCall innercc
14841477 ) {
1485- fwdFlowOut0 ( ret , state , innercc , summaryCtx , argT , argAp , t , ap , apa , inner ) and
1486- viableImplNotCallContextReducedReverse ( innercc )
1478+ viableImplNotCallContextReducedReverse ( innercc ) and
1479+ flowOutOfCallApa ( call , c , ret , _ , out , allowsFieldFlow , apa )
14871480 }
14881481
14891482 // inline to reduce number of iterations
@@ -1496,13 +1489,15 @@ module MakeImpl<InputSig Lang> {
14961489 DataFlowCall call , RetNodeEx ret , boolean allowsFieldFlow , CcNoCall innercc ,
14971490 DataFlowCallable inner
14981491 |
1499- fwdFlowOutCallContextReduced ( call , ret , state , innercc , summaryCtx , argT , argAp , t , ap ,
1500- apa , inner )
1501- or
1502- fwdFlowOutNotCallContextReduced ( ret , state , innercc , summaryCtx , argT , argAp , t , ap ,
1503- apa , inner )
1492+ fwdFlow ( ret , state , innercc , summaryCtx , argT , argAp , t , ap , apa ) and
1493+ (
1494+ flowOutOfCallApaCallContextReduced ( call , inner , ret , out , allowsFieldFlow , apa ,
1495+ innercc )
1496+ or
1497+ flowOutOfCallApaNotCallContextReduced ( call , inner , ret , out , allowsFieldFlow , apa ,
1498+ innercc )
1499+ )
15041500 |
1505- flowOutOfCallApa ( call , ret , inner , _, out , allowsFieldFlow , apa ) and
15061501 outercc = getCallContextReturn ( inner , call ) and
15071502 if allowsFieldFlow = false then ap instanceof ApNil else any ( )
15081503 )
@@ -1605,7 +1600,7 @@ module MakeImpl<InputSig Lang> {
16051600 DataFlowCall call , ArgNodeEx arg , ParamNodeEx p , boolean allowsFieldFlow , Ap argAp , Ap ap
16061601 ) {
16071602 exists ( ApApprox argApa , Typ argT |
1608- flowIntoCallApa ( call , pragma [ only_bind_into ] ( arg ) , pragma [ only_bind_into ] ( p ) , _ ,
1603+ flowIntoCallApa ( call , _ , pragma [ only_bind_into ] ( arg ) , pragma [ only_bind_into ] ( p ) ,
16091604 allowsFieldFlow , argApa ) and
16101605 fwdFlow ( arg , _, _, _, _, _, pragma [ only_bind_into ] ( argT ) , pragma [ only_bind_into ] ( argAp ) ,
16111606 argApa ) and
@@ -1618,7 +1613,7 @@ module MakeImpl<InputSig Lang> {
16181613 pragma [ nomagic]
16191614 private predicate flowIntoCallAp ( DataFlowCall call , ArgNodeEx arg , ParamNodeEx p , Ap ap ) {
16201615 exists ( ApApprox apa , boolean allowsFieldFlow |
1621- flowIntoCallApa ( call , arg , p , _ , allowsFieldFlow , apa ) and
1616+ flowIntoCallApa ( call , _ , arg , p , allowsFieldFlow , apa ) and
16221617 fwdFlow ( arg , _, _, _, _, _, _, ap , apa ) and
16231618 if allowsFieldFlow = false then ap instanceof ApNil else any ( )
16241619 )
@@ -1629,7 +1624,7 @@ module MakeImpl<InputSig Lang> {
16291624 DataFlowCall call , RetNodeEx ret , ReturnPosition pos , NodeEx out , Ap ap
16301625 ) {
16311626 exists ( ApApprox apa , boolean allowsFieldFlow |
1632- flowOutOfCallApa ( call , ret , _ , _, out , allowsFieldFlow , apa ) and
1627+ flowOutOfCallApa ( call , _ , ret , _, out , allowsFieldFlow , apa ) and
16331628 fwdFlow ( ret , _, _, _, _, _, _, ap , apa ) and
16341629 pos = ret .getReturnPosition ( ) and
16351630 if allowsFieldFlow = false then ap instanceof ApNil else any ( )
@@ -1968,7 +1963,6 @@ module MakeImpl<InputSig Lang> {
19681963 none ( )
19691964 }
19701965
1971- bindingset [ ctx]
19721966 predicate viableImplNotCallContextReducedReverse ( CcNoCall ctx ) { any ( ) }
19731967
19741968 bindingset [ call, c]
@@ -2043,7 +2037,6 @@ module MakeImpl<InputSig Lang> {
20432037 result = prunedViableImplInCallContextReverse ( call , ctx )
20442038 }
20452039
2046- bindingset [ ctx]
20472040 predicate viableImplNotCallContextReducedReverse ( CcNoCall ctx ) {
20482041 ctx instanceof CallContextAny
20492042 }
0 commit comments