@@ -88,7 +88,7 @@ private predicate localTaintStep(DataFlowNode src, DataFlowNode sink) {
8888}
8989
9090cached
91- private module DefUse {
91+ module DefUse {
9292 /**
9393 * A classification of variable references into reads and writes.
9494 */
@@ -185,21 +185,26 @@ private module DefUse {
185185 )
186186 }
187187
188- /** Holds if the update `def ` can be used at the read `use`. */
188+ /** Holds if the variable update `vu ` can be used at the read `use`. */
189189 cached
190- predicate defUseImpl ( StackVariable target , DataFlowNode def , ReadAccess use ) {
191- exists ( VariableUpdate vu | def = vu .getSource ( ) |
192- defReachesReadWithinBlock ( target , vu , use )
193- or
194- exists ( BasicBlock bb , int i |
195- exists ( refRank ( bb , i , target , Read ( ) ) ) and
196- use = bb .getNode ( i ) and
197- defReachesEndOfBlock ( bb .getAPredecessor ( ) , vu , target ) and
198- not defReachesReadWithinBlock ( target , _, use )
199- )
190+ predicate variableUpdateUse ( StackVariable target , VariableUpdate vu , ReadAccess use ) {
191+ defReachesReadWithinBlock ( target , vu , use )
192+ or
193+ exists ( BasicBlock bb , int i |
194+ exists ( refRank ( bb , i , target , Read ( ) ) ) and
195+ use = bb .getNode ( i ) and
196+ defReachesEndOfBlock ( bb .getAPredecessor ( ) , vu , target ) and
197+ not defReachesReadWithinBlock ( target , _, use )
200198 )
201199 }
200+
201+ /** Holds if the update `def` can be used at the read `use`. */
202+ cached
203+ predicate defUse ( StackVariable target , Expr def , ReadAccess use ) {
204+ exists ( VariableUpdate vu | def = vu .getSource ( ) | variableUpdateUse ( target , vu , use ) )
205+ }
202206}
207+ private import DefUse
203208
204209abstract library class VariableUpdate extends Instruction {
205210 abstract Expr getSource ( ) ;
@@ -224,5 +229,3 @@ private class MethodOutOrRefTarget extends VariableUpdate, Call {
224229
225230 override Expr getSource ( ) { result = this }
226231}
227-
228- predicate defUse = DefUse:: defUseImpl / 3 ;
0 commit comments