@@ -904,72 +904,77 @@ private module Stage2 {
904904 * records whether a field must be read from the returned value.
905905 */
906906 predicate revFlow ( Node node , boolean toReturn , ApOption returnAp , Ap ap , Configuration config ) {
907- fwdFlow ( node , _, _, false , config ) and
907+ revFlow0 ( node , toReturn , returnAp , ap , config ) and
908+ fwdFlow ( node , _, _, ap , config )
909+ }
910+
911+ pragma [ nomagic]
912+ private predicate revFlow0 (
913+ Node node , boolean toReturn , ApOption returnAp , Ap ap , Configuration config
914+ ) {
915+ fwdFlow ( node , _, _, ap , config ) and
908916 config .isSink ( node ) and
909917 toReturn = false and
910918 returnAp = apNone ( ) and
911919 ap = false
912920 or
913- fwdFlow ( node , _, _, unbindBool ( ap ) , unbind ( config ) ) and
914- (
915- exists ( Node mid |
916- localFlowStepNodeCand1 ( node , mid , config ) and
917- revFlow ( mid , toReturn , returnAp , ap , config )
918- )
919- or
920- exists ( Node mid |
921- additionalLocalFlowStepNodeCand1 ( node , mid , config ) and
922- revFlow ( mid , toReturn , returnAp , ap , config ) and
923- ap = false
924- )
925- or
926- exists ( Node mid |
927- jumpStep ( node , mid , config ) and
928- revFlow ( mid , _, _, ap , config ) and
929- toReturn = false and
930- returnAp = apNone ( )
931- )
932- or
933- exists ( Node mid |
934- additionalJumpStep ( node , mid , config ) and
935- revFlow ( mid , _, _, ap , config ) and
936- toReturn = false and
937- returnAp = apNone ( ) and
938- ap = false
939- )
940- or
941- // store
942- exists ( Content c |
943- revFlowStore ( c , node , toReturn , returnAp , ap , config ) and
944- revFlowIsRead ( c , ap , config )
945- )
946- or
947- // read
948- exists ( Node mid , Content c , Ap ap0 |
949- read ( node , c , mid , config ) and
950- fwdFlowIsStored ( c , unbindBool ( ap0 ) , unbind ( config ) ) and
951- revFlow ( mid , toReturn , returnAp , ap0 , config ) and
952- ap = true
953- )
921+ exists ( Node mid |
922+ localFlowStepNodeCand1 ( node , mid , config ) and
923+ revFlow ( mid , toReturn , returnAp , ap , config )
924+ )
925+ or
926+ exists ( Node mid |
927+ additionalLocalFlowStepNodeCand1 ( node , mid , config ) and
928+ revFlow ( mid , toReturn , returnAp , ap , config ) and
929+ ap = false
930+ )
931+ or
932+ exists ( Node mid |
933+ jumpStep ( node , mid , config ) and
934+ revFlow ( mid , _, _, ap , config ) and
935+ toReturn = false and
936+ returnAp = apNone ( )
937+ )
938+ or
939+ exists ( Node mid |
940+ additionalJumpStep ( node , mid , config ) and
941+ revFlow ( mid , _, _, ap , config ) and
942+ toReturn = false and
943+ returnAp = apNone ( ) and
944+ ap = false
945+ )
946+ or
947+ // store
948+ exists ( Content c |
949+ revFlowStore ( c , node , toReturn , returnAp , ap , config ) and
950+ revFlowIsRead ( c , ap , config )
951+ )
952+ or
953+ // read
954+ exists ( Node mid , Content c , Ap ap0 |
955+ read ( node , c , mid , config ) and
956+ fwdFlowIsStored ( c , unbindBool ( ap0 ) , unbind ( config ) ) and
957+ revFlow ( mid , toReturn , returnAp , ap0 , config ) and
958+ ap = true
959+ )
960+ or
961+ // flow into a callable
962+ exists ( DataFlowCall call |
963+ revFlowIn ( call , node , toReturn , returnAp , ap , config ) and
964+ toReturn = false
954965 or
955- // flow into a callable
956- exists ( DataFlowCall call |
957- revFlowIn ( call , node , toReturn , returnAp , ap , config ) and
958- toReturn = false
959- or
960- exists ( boolean returnAp0 |
961- revFlowInToReturn ( call , node , returnAp0 , ap , config ) and
962- revFlowIsReturned ( call , toReturn , returnAp , returnAp0 , config )
963- )
966+ exists ( boolean returnAp0 |
967+ revFlowInToReturn ( call , node , returnAp0 , ap , config ) and
968+ revFlowIsReturned ( call , toReturn , returnAp , returnAp0 , config )
964969 )
965- or
966- // flow out of a callable
967- revFlowOut ( _, node , _, _, ap , config ) and
968- toReturn = true and
969- if fwdFlow ( node , true , apSome ( _) , unbindBool ( ap ) , config )
970- then returnAp = apSome ( ap )
971- else returnAp = apNone ( )
972970 )
971+ or
972+ // flow out of a callable
973+ revFlowOut ( _, node , _, _, ap , config ) and
974+ toReturn = true and
975+ if fwdFlow ( node , true , apSome ( _) , unbindBool ( ap ) , config )
976+ then returnAp = apSome ( ap )
977+ else returnAp = apNone ( )
973978 }
974979
975980 /**
0 commit comments