@@ -905,31 +905,35 @@ private predicate localFlowExit(Node node, Configuration config) {
905905 */
906906pragma [ nomagic]
907907private predicate localFlowStepPlus (
908- Node node1 , Node node2 , boolean preservesValue , Configuration config
908+ Node node1 , Node node2 , boolean preservesValue , Configuration config , LocalCallContext cc
909909) {
910+ not isUnreachableInCall ( node2 , cc .( LocalCallContextSpecificCall ) .getCall ( ) ) and
911+ (
910912 localFlowEntry ( node1 , config ) and
911913 (
912914 localFlowStep ( node1 , node2 , config ) and preservesValue = true
913915 or
914916 additionalLocalFlowStep ( node1 , node2 , config ) and preservesValue = false
915917 ) and
916918 node1 != node2 and
919+ cc .validFor ( node1 ) and
917920 nodeCand ( node2 , unbind ( config ) )
918921 or
919922 exists ( Node mid |
920- localFlowStepPlus ( node1 , mid , preservesValue , config ) and
923+ localFlowStepPlus ( node1 , mid , preservesValue , config , cc ) and
921924 localFlowStep ( mid , node2 , config ) and
922925 not mid instanceof CastNode and
923926 nodeCand ( node2 , unbind ( config ) )
924927 )
925928 or
926929 exists ( Node mid |
927- localFlowStepPlus ( node1 , mid , _, config ) and
930+ localFlowStepPlus ( node1 , mid , _, config , cc ) and
928931 additionalLocalFlowStep ( mid , node2 , config ) and
929932 not mid instanceof CastNode and
930933 preservesValue = false and
931934 nodeCand ( node2 , unbind ( config ) )
932935 )
936+ )
933937}
934938
935939/**
@@ -938,9 +942,9 @@ private predicate localFlowStepPlus(
938942 */
939943pragma [ noinline]
940944private predicate localFlowBigStep (
941- Node node1 , Node node2 , boolean preservesValue , Configuration config
945+ Node node1 , Node node2 , boolean preservesValue , Configuration config , LocalCallContext callContext
942946) {
943- localFlowStepPlus ( node1 , node2 , preservesValue , config ) and
947+ localFlowStepPlus ( node1 , node2 , preservesValue , config , callContext ) and
944948 localFlowExit ( node2 , config )
945949}
946950
@@ -1000,7 +1004,7 @@ private class AccessPathFrontNilNode extends Node {
10001004 (
10011005 any ( Configuration c ) .isSource ( this )
10021006 or
1003- localFlowBigStep ( _, this , false , _)
1007+ localFlowBigStep ( _, this , false , _, _ )
10041008 or
10051009 additionalJumpStep ( _, this , _)
10061010 )
@@ -1023,12 +1027,12 @@ private predicate flowCandFwd0(Node node, boolean fromArg, AccessPathFront apf,
10231027 (
10241028 exists ( Node mid |
10251029 flowCandFwd ( mid , fromArg , apf , config ) and
1026- localFlowBigStep ( mid , node , true , config )
1030+ localFlowBigStep ( mid , node , true , config , _ )
10271031 )
10281032 or
10291033 exists ( Node mid , AccessPathFrontNil nil |
10301034 flowCandFwd ( mid , fromArg , nil , config ) and
1031- localFlowBigStep ( mid , node , false , config ) and
1035+ localFlowBigStep ( mid , node , false , config , _ ) and
10321036 apf = node .( AccessPathFrontNilNode ) .getApf ( )
10331037 )
10341038 or
@@ -1122,13 +1126,13 @@ private predicate flowCand0(Node node, boolean toReturn, AccessPathFront apf, Co
11221126 apf instanceof AccessPathFrontNil
11231127 or
11241128 exists ( Node mid |
1125- localFlowBigStep ( node , mid , true , config ) and
1129+ localFlowBigStep ( node , mid , true , config , _ ) and
11261130 flowCand ( mid , toReturn , apf , config )
11271131 )
11281132 or
11291133 exists ( Node mid , AccessPathFrontNil nil |
11301134 flowCandFwd ( node , _, apf , config ) and
1131- localFlowBigStep ( node , mid , false , config ) and
1135+ localFlowBigStep ( node , mid , false , config , _ ) and
11321136 flowCand ( mid , toReturn , nil , config ) and
11331137 apf instanceof AccessPathFrontNil
11341138 )
@@ -1363,12 +1367,12 @@ private predicate flowFwd0(
13631367 (
13641368 exists ( Node mid |
13651369 flowFwd ( mid , fromArg , apf , ap , config ) and
1366- localFlowBigStep ( mid , node , true , config )
1370+ localFlowBigStep ( mid , node , true , config , _ )
13671371 )
13681372 or
13691373 exists ( Node mid , AccessPathNil nil |
13701374 flowFwd ( mid , fromArg , _, nil , config ) and
1371- localFlowBigStep ( mid , node , false , config ) and
1375+ localFlowBigStep ( mid , node , false , config , _ ) and
13721376 ap = node .( AccessPathNilNode ) .getAp ( ) and
13731377 apf = ap .( AccessPathNil ) .getFront ( )
13741378 )
@@ -1472,13 +1476,13 @@ private predicate flow0(Node node, boolean toReturn, AccessPath ap, Configuratio
14721476 ap instanceof AccessPathNil
14731477 or
14741478 exists ( Node mid |
1475- localFlowBigStep ( node , mid , true , config ) and
1479+ localFlowBigStep ( node , mid , true , config , _ ) and
14761480 flow ( mid , toReturn , ap , config )
14771481 )
14781482 or
14791483 exists ( Node mid , AccessPathNil nil |
14801484 flowFwd ( node , _, _, ap , config ) and
1481- localFlowBigStep ( node , mid , false , config ) and
1485+ localFlowBigStep ( node , mid , false , config , _ ) and
14821486 flow ( mid , toReturn , nil , config ) and
14831487 ap instanceof AccessPathNil
14841488 )
@@ -1664,8 +1668,11 @@ module PathGraph {
16641668 */
16651669private class PathNodeMid extends PathNode , TPathNodeMid {
16661670 Node node ;
1671+
16671672 CallContext cc ;
1673+
16681674 AccessPath ap ;
1675+
16691676 Configuration config ;
16701677
16711678 PathNodeMid ( ) { this = TPathNodeMid ( node , cc , ap , config ) }
@@ -1711,6 +1718,7 @@ private class PathNodeMid extends PathNode, TPathNodeMid {
17111718 */
17121719private class PathNodeSink extends PathNode , TPathNodeSink {
17131720 Node node ;
1721+
17141722 Configuration config ;
17151723
17161724 PathNodeSink ( ) { this = TPathNodeSink ( node , config ) }
@@ -1729,15 +1737,18 @@ private class PathNodeSink extends PathNode, TPathNodeSink {
17291737 * a callable is recorded by `cc`.
17301738 */
17311739private predicate pathStep ( PathNodeMid mid , Node node , CallContext cc , AccessPath ap ) {
1732- localFlowBigStep ( mid .getNode ( ) , node , true , mid .getConfiguration ( ) ) and
1740+ exists ( LocalCallContext localCC | localCC .matchesCallContext ( cc ) |
1741+ localFlowBigStep ( mid .getNode ( ) , node , true , mid .getConfiguration ( ) , localCC ) and
17331742 cc = mid .getCallContext ( ) and
17341743 ap = mid .getAp ( )
17351744 or
1736- localFlowBigStep ( mid .getNode ( ) , node , false , mid .getConfiguration ( ) ) and
1745+ localFlowBigStep ( mid .getNode ( ) , node , false , mid .getConfiguration ( ) , localCC ) and
17371746 cc = mid .getCallContext ( ) and
17381747 mid .getAp ( ) instanceof AccessPathNil and
17391748 ap = node .( AccessPathNilNode ) .getAp ( )
1740- or
1749+ ) or
1750+ not isUnreachableInCall ( node , cc .( CallContextSpecificCall ) .getCall ( ) ) and
1751+ (
17411752 jumpStep ( mid .getNode ( ) , node , mid .getConfiguration ( ) ) and
17421753 cc instanceof CallContextAny and
17431754 ap = mid .getAp ( )
@@ -1760,6 +1771,7 @@ private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, AccessPat
17601771 pathThroughCallable ( mid , node , cc , ap )
17611772 or
17621773 valuePathThroughCallable ( mid , node , cc ) and ap = mid .getAp ( )
1774+ )
17631775}
17641776
17651777pragma [ noinline]
@@ -1880,7 +1892,7 @@ private predicate pathIntoCallable(
18801892 pathIntoCallable0 ( mid , callable , i , outercc , call , emptyAp ) and
18811893 p .isParameterOf ( callable , i )
18821894 |
1883- if reducedViableImplInCallContext ( _ , callable , call )
1895+ if recordDataFlowCallSite ( call , callable )
18841896 then innercc = TSpecificCall ( call , i , emptyAp )
18851897 else innercc = TSomeCall ( p , emptyAp )
18861898 )
@@ -2180,8 +2192,11 @@ private module FlowExploration {
21802192
21812193 private class PartialPathNodePriv extends PartialPathNode {
21822194 Node node ;
2195+
21832196 CallContext cc ;
2197+
21842198 PartialAccessPath ap ;
2199+
21852200 Configuration config ;
21862201
21872202 PartialPathNodePriv ( ) { this = TPartialPathNodeMk ( node , cc , ap , config ) }
@@ -2378,7 +2393,7 @@ private module FlowExploration {
23782393 partialPathIntoCallable0 ( mid , callable , i , outercc , call , emptyAp , ap , config ) and
23792394 p .isParameterOf ( callable , i )
23802395 |
2381- if reducedViableImplInCallContext ( _ , callable , call )
2396+ if recordDataFlowCallSite ( call , callable )
23822397 then innercc = TSpecificCall ( call , i , emptyAp )
23832398 else innercc = TSomeCall ( p , emptyAp )
23842399 )
@@ -2446,7 +2461,6 @@ private module FlowExploration {
24462461 )
24472462 }
24482463}
2449-
24502464import FlowExploration
24512465
24522466private predicate partialFlow (
0 commit comments