@@ -481,7 +481,6 @@ private module Stage1 {
481481 pragma [ nomagic]
482482 private predicate revFlowIsRead ( Content c , Configuration config ) {
483483 exists ( Node mid , Node node |
484- useFieldFlow ( config ) and
485484 fwdFlow ( node , unbind ( config ) ) and
486485 read ( node , c , mid ) and
487486 fwdFlowIsStored ( c , unbind ( config ) ) and
@@ -839,8 +838,6 @@ private module Stage2 {
839838 pragma [ noinline]
840839 private predicate fwdFlowConsCand ( Content c , Ap ap , Configuration config ) {
841840 exists ( Node mid , Node node |
842- useFieldFlow ( config ) and
843- Stage1:: revFlow ( node , unbind ( config ) ) and
844841 fwdFlow ( mid , _, _, ap , config ) and
845842 storeCand1 ( mid , c , node , config )
846843 )
@@ -990,7 +987,6 @@ private module Stage2 {
990987 pragma [ noinline]
991988 private predicate revFlowConsCand ( Content c , Ap ap , Configuration config ) {
992989 exists ( Node mid , Node node |
993- useFieldFlow ( config ) and
994990 fwdFlow ( node , _, _, true , unbind ( config ) ) and
995991 read ( node , c , mid , config ) and
996992 fwdFlowConsCand ( c , unbindBool ( ap ) , unbind ( config ) ) and
@@ -1305,12 +1301,9 @@ private module Stage3 {
13051301 )
13061302 or
13071303 // store
1308- exists ( Node mid , TypedContent tc , Ap ap0 , DataFlowType contentType |
1309- fwdFlow ( mid , cc , argAp , ap0 , config ) and
1310- storeCand2 ( mid , tc , node , contentType , config ) and
1311- Stage2:: revFlow ( node , _, _, true , unbind ( config ) ) and
1312- ap .headUsesContent ( tc ) and
1313- compatibleTypes ( ap0 .getType ( ) , contentType )
1304+ exists ( TypedContent tc |
1305+ fwdFlowStore ( node , tc , _, cc , argAp , config ) and
1306+ ap .headUsesContent ( tc )
13141307 )
13151308 or
13161309 // read
@@ -1340,15 +1333,23 @@ private module Stage3 {
13401333 }
13411334
13421335 pragma [ nomagic]
1343- private predicate fwdFlowConsCand ( TypedContent tc , Ap ap , Configuration config ) {
1344- exists ( Node mid , Node n , DataFlowType contentType |
1345- fwdFlow ( mid , _, _, ap , config ) and
1346- storeCand2 ( mid , tc , n , contentType , config ) and
1347- Stage2:: revFlow ( n , _, _, true , unbind ( config ) ) and
1348- compatibleTypes ( ap .getType ( ) , contentType )
1336+ private predicate fwdFlowStore (
1337+ Node node , TypedContent tc , Ap ap0 , Cc cc , ApOption argAp , Configuration config
1338+ ) {
1339+ exists ( Node mid , DataFlowType contentType |
1340+ fwdFlow ( mid , cc , argAp , ap0 , config ) and
1341+ storeCand2 ( mid , tc , node , contentType , config ) and
1342+ // We need to typecheck stores here, since reverse flow through a getter
1343+ // might have a different type here compared to inside the getter.
1344+ compatibleTypes ( ap0 .getType ( ) , contentType )
13491345 )
13501346 }
13511347
1348+ pragma [ nomagic]
1349+ private predicate fwdFlowConsCand ( TypedContent tc , Ap ap , Configuration config ) {
1350+ fwdFlowStore ( _, tc , ap , _, _, config )
1351+ }
1352+
13521353 pragma [ nomagic]
13531354 private predicate fwdFlowRead0 (
13541355 Node node1 , TypedContent tc , Content c , Node node2 , Cc cc , ApOption argAp ,
@@ -1889,6 +1890,14 @@ private module Stage4 {
18891890 )
18901891 }
18911892
1893+ pragma [ nomagic]
1894+ private predicate fwdFlowConsCand (
1895+ TypedContent tc , AccessPathFront apf , Ap ap , Configuration config
1896+ ) {
1897+ fwdFlowStore ( _, tc , ap , _, _, config ) and
1898+ apf = ap .getFront ( )
1899+ }
1900+
18921901 pragma [ nomagic]
18931902 private predicate storeCand (
18941903 Node mid , TypedContent tc , Node node , AccessPathFront apf0 , AccessPathFront apf ,
@@ -1929,17 +1938,6 @@ private module Stage4 {
19291938 )
19301939 }
19311940
1932- pragma [ nomagic]
1933- private predicate fwdFlowConsCand (
1934- TypedContent tc , AccessPathFront apf , Ap ap , Configuration config
1935- ) {
1936- exists ( Node n |
1937- fwdFlow ( n , _, _, ap , config ) and
1938- apf = ap .getFront ( ) and
1939- fwdFlowStore0 ( n , tc , _, apf , config )
1940- )
1941- }
1942-
19431941 pragma [ nomagic]
19441942 private predicate fwdFlowIn (
19451943 DataFlowCall call , ParameterNode p , Cc outercc , Cc innercc , ApOption argAp , Ap ap ,
0 commit comments