@@ -830,6 +830,10 @@ private module Stage2 {
830830 exists ( lcc )
831831 }
832832
833+ private predicate flowOutOfCall = flowOutOfCallNodeCand1 / 5 ;
834+
835+ private predicate flowIntoCall = flowIntoCallNodeCand1 / 5 ;
836+
833837 /* Begin: Stage 2 logic. */
834838 private predicate flowCand ( Node node , ApApprox apa , Configuration config ) {
835839 PrevStage:: revFlow ( node , _, _, apa , config )
@@ -948,7 +952,7 @@ private module Stage2 {
948952 ) {
949953 exists ( ArgumentNode arg , boolean allowsFieldFlow |
950954 fwdFlow ( arg , outercc , argAp , ap , config ) and
951- flowIntoCallNodeCand1 ( call , arg , p , allowsFieldFlow , config ) and
955+ flowIntoCall ( call , arg , p , allowsFieldFlow , config ) and
952956 innercc = getCallContextCall ( call , p .getEnclosingCallable ( ) , outercc )
953957 |
954958 ap instanceof ApNil or allowsFieldFlow = true
@@ -961,7 +965,7 @@ private module Stage2 {
961965 ) {
962966 exists ( ReturnNodeExt ret , boolean allowsFieldFlow , DataFlowCallable inner |
963967 fwdFlow ( ret , innercc , argAp , ap , config ) and
964- flowOutOfCallNodeCand1 ( call , ret , node , allowsFieldFlow , config ) and
968+ flowOutOfCall ( call , ret , node , allowsFieldFlow , config ) and
965969 inner = ret .getEnclosingCallable ( ) and
966970 checkCallContextReturn ( innercc , inner , call ) and
967971 ccOut = getCallContextReturn ( inner , call )
@@ -1115,7 +1119,7 @@ private module Stage2 {
11151119 ) {
11161120 exists ( Node out , boolean allowsFieldFlow |
11171121 revFlow ( out , toReturn , returnAp , ap , config ) and
1118- flowOutOfCallNodeCand1 ( call , ret , out , allowsFieldFlow , config )
1122+ flowOutOfCall ( call , ret , out , allowsFieldFlow , config )
11191123 |
11201124 ap instanceof ApNil or allowsFieldFlow = true
11211125 )
@@ -1128,7 +1132,7 @@ private module Stage2 {
11281132 ) {
11291133 exists ( ParameterNode p , boolean allowsFieldFlow |
11301134 revFlow ( p , toReturn , returnAp , ap , config ) and
1131- flowIntoCallNodeCand1 ( call , arg , p , allowsFieldFlow , config )
1135+ flowIntoCall ( call , arg , p , allowsFieldFlow , config )
11321136 |
11331137 ap instanceof ApNil or allowsFieldFlow = true
11341138 )
@@ -1148,9 +1152,9 @@ private module Stage2 {
11481152 private predicate revFlowIsReturned (
11491153 DataFlowCall call , boolean toReturn , ApOption returnAp , Ap ap , Configuration config
11501154 ) {
1151- exists ( ReturnNodeExt ret |
1155+ exists ( ReturnNodeExt ret , CcCall ccc |
11521156 revFlowOut ( call , ret , toReturn , returnAp , ap , config ) and
1153- fwdFlow ( ret , true , apSome ( _) , ap , config )
1157+ fwdFlow ( ret , ccc , apSome ( _) , ap , config )
11541158 )
11551159 }
11561160
@@ -1415,6 +1419,10 @@ private module Stage3 {
14151419 localFlowBigStep ( node1 , node2 , preservesValue , ap , config , _) and exists ( lcc )
14161420 }
14171421
1422+ private predicate flowOutOfCall = flowOutOfCallNodeCand2 / 5 ;
1423+
1424+ private predicate flowIntoCall = flowIntoCallNodeCand2 / 5 ;
1425+
14181426 /* Begin: Stage 3 logic. */
14191427 private predicate flowCand ( Node node , ApApprox apa , Configuration config ) {
14201428 PrevStage:: revFlow ( node , _, _, apa , config )
@@ -1542,7 +1550,7 @@ private module Stage3 {
15421550 ) {
15431551 exists ( ArgumentNode arg , boolean allowsFieldFlow |
15441552 fwdFlow ( arg , outercc , argAp , ap , config ) and
1545- flowIntoCallNodeCand2 ( call , arg , p , allowsFieldFlow , config ) and
1553+ flowIntoCall ( call , arg , p , allowsFieldFlow , config ) and
15461554 innercc = getCallContextCall ( call , p .getEnclosingCallable ( ) , outercc )
15471555 |
15481556 ap instanceof ApNil or allowsFieldFlow = true
@@ -1555,7 +1563,7 @@ private module Stage3 {
15551563 ) {
15561564 exists ( ReturnNodeExt ret , boolean allowsFieldFlow , DataFlowCallable inner |
15571565 fwdFlow ( ret , innercc , argAp , ap , config ) and
1558- flowOutOfCallNodeCand2 ( call , ret , node , allowsFieldFlow , config ) and
1566+ flowOutOfCall ( call , ret , node , allowsFieldFlow , config ) and
15591567 inner = ret .getEnclosingCallable ( ) and
15601568 checkCallContextReturn ( innercc , inner , call ) and
15611569 ccOut = getCallContextReturn ( inner , call )
@@ -1706,7 +1714,7 @@ private module Stage3 {
17061714 ) {
17071715 exists ( Node out , boolean allowsFieldFlow |
17081716 revFlow ( out , toReturn , returnAp , ap , config ) and
1709- flowOutOfCallNodeCand2 ( call , ret , out , allowsFieldFlow , config )
1717+ flowOutOfCall ( call , ret , out , allowsFieldFlow , config )
17101718 |
17111719 ap instanceof ApNil or allowsFieldFlow = true
17121720 )
@@ -1719,7 +1727,7 @@ private module Stage3 {
17191727 ) {
17201728 exists ( ParameterNode p , boolean allowsFieldFlow |
17211729 revFlow ( p , toReturn , returnAp , ap , config ) and
1722- flowIntoCallNodeCand2 ( call , arg , p , allowsFieldFlow , config )
1730+ flowIntoCall ( call , arg , p , allowsFieldFlow , config )
17231731 |
17241732 ap instanceof ApNil or allowsFieldFlow = true
17251733 )
@@ -1739,9 +1747,9 @@ private module Stage3 {
17391747 private predicate revFlowIsReturned (
17401748 DataFlowCall call , boolean toReturn , ApOption returnAp , Ap ap , Configuration config
17411749 ) {
1742- exists ( ReturnNodeExt ret |
1750+ exists ( ReturnNodeExt ret , CcCall ccc |
17431751 revFlowOut ( call , ret , toReturn , returnAp , ap , config ) and
1744- fwdFlow ( ret , true , apSome ( _) , ap , config )
1752+ fwdFlow ( ret , ccc , apSome ( _) , ap , config )
17451753 )
17461754 }
17471755
@@ -2077,6 +2085,26 @@ private module Stage4 {
20772085 localFlowBigStep ( node1 , node2 , preservesValue , ap .getFront ( ) , config , lcc )
20782086 }
20792087
2088+ pragma [ nomagic]
2089+ private predicate flowOutOfCall (
2090+ DataFlowCall call , ReturnNodeExt node1 , Node node2 , boolean allowsFieldFlow ,
2091+ Configuration config
2092+ ) {
2093+ flowOutOfCallNodeCand2 ( call , node1 , node2 , allowsFieldFlow , config ) and
2094+ PrevStage:: revFlow ( node2 , _, _, _, config ) and
2095+ PrevStage:: revFlow ( node1 , _, _, _, unbind ( config ) )
2096+ }
2097+
2098+ pragma [ nomagic]
2099+ private predicate flowIntoCall (
2100+ DataFlowCall call , ArgumentNode node1 , ParameterNode node2 , boolean allowsFieldFlow ,
2101+ Configuration config
2102+ ) {
2103+ flowIntoCallNodeCand2 ( call , node1 , node2 , allowsFieldFlow , config ) and
2104+ PrevStage:: revFlow ( node2 , _, _, _, config ) and
2105+ PrevStage:: revFlow ( node1 , _, _, _, unbind ( config ) )
2106+ }
2107+
20802108 /* Begin: Stage 4 logic. */
20812109 private predicate flowCand ( Node node , ApApprox apa , Configuration config ) {
20822110 PrevStage:: revFlow ( node , _, _, apa , config )
@@ -2197,8 +2225,7 @@ private module Stage4 {
21972225 ) {
21982226 exists ( ArgumentNode arg , boolean allowsFieldFlow |
21992227 fwdFlow ( arg , outercc , argAp , ap , config ) and
2200- flowIntoCallNodeCand2 ( call , arg , p , allowsFieldFlow , config ) and
2201- flowCand ( p , _, unbind ( config ) ) and
2228+ flowIntoCall ( call , arg , p , allowsFieldFlow , config ) and
22022229 innercc = getCallContextCall ( call , p .getEnclosingCallable ( ) , outercc )
22032230 |
22042231 ap instanceof ApNil or allowsFieldFlow = true
@@ -2211,9 +2238,8 @@ private module Stage4 {
22112238 ) {
22122239 exists ( ReturnNodeExt ret , boolean allowsFieldFlow , DataFlowCallable inner |
22132240 fwdFlow ( ret , innercc , argAp , ap , config ) and
2214- flowOutOfCallNodeCand2 ( call , ret , node , allowsFieldFlow , config ) and
2241+ flowOutOfCall ( call , ret , node , allowsFieldFlow , config ) and
22152242 inner = ret .getEnclosingCallable ( ) and
2216- flowCand ( node , _, unbind ( config ) ) and
22172243 checkCallContextReturn ( innercc , inner , call ) and
22182244 ccOut = getCallContextReturn ( inner , call )
22192245 |
@@ -2363,7 +2389,7 @@ private module Stage4 {
23632389 ) {
23642390 exists ( Node out , boolean allowsFieldFlow |
23652391 revFlow ( out , toReturn , returnAp , ap , config ) and
2366- flowOutOfCallNodeCand2 ( call , ret , out , allowsFieldFlow , config )
2392+ flowOutOfCall ( call , ret , out , allowsFieldFlow , config )
23672393 |
23682394 ap instanceof ApNil or allowsFieldFlow = true
23692395 )
@@ -2376,7 +2402,7 @@ private module Stage4 {
23762402 ) {
23772403 exists ( ParameterNode p , boolean allowsFieldFlow |
23782404 revFlow ( p , toReturn , returnAp , ap , config ) and
2379- flowIntoCallNodeCand2 ( call , arg , p , allowsFieldFlow , config )
2405+ flowIntoCall ( call , arg , p , allowsFieldFlow , config )
23802406 |
23812407 ap instanceof ApNil or allowsFieldFlow = true
23822408 )
0 commit comments