@@ -491,6 +491,8 @@ public FlowFunction<Abstraction> getReturnFlowFunction(final Unit callSite, fina
491491 // This is not cached by Soot, so accesses are more expensive
492492 // than one might think
493493 final Local thisLocal = callee .isStatic () ? null : callee .getActiveBody ().getThisLocal ();
494+ final InvokeExpr ie = iCallStmt != null && iCallStmt .containsInvokeExpr () ? iCallStmt .getInvokeExpr () : null ;
495+ final boolean isExecutorExecute = interproceduralCFG ().isExecutorExecute (ie , callee );
494496
495497 return new SolverReturnFlowFunction () {
496498
@@ -668,28 +670,38 @@ private Set<Abstraction> computeTargetsInternal(Abstraction source, Abstraction
668670 // check if it is not one of the params
669671 // (then we have already fixed it)
670672 if (!parameterAliases && !thisAliases && source .getAccessPath ().getTaintSubFields ()
671- && iCallStmt .getInvokeExpr () instanceof InstanceInvokeExpr
672673 && aliasing .mayAlias (thisLocal , sourceBase )) {
673- // Type check
674- if (manager .getTypeUtils ().checkCast (source .getAccessPath (), thisLocal .getType ())) {
675- InstanceInvokeExpr iIExpr = (InstanceInvokeExpr ) iCallStmt .getInvokeExpr ();
676-
677- // Get the caller-side base local
678- // and create a new access path for it
679- Value callerBaseLocal = interproceduralCFG ().isReflectiveCallSite (iIExpr )
680- ? iIExpr .getArg (0 )
681- : iIExpr .getBase ();
682- AccessPath ap = manager .getAccessPathFactory ().copyWithNewValue (
683- newSource .getAccessPath (), callerBaseLocal ,
684- isReflectiveCallSite ? null : newSource .getAccessPath ().getBaseType (),
685- false );
686- Abstraction abs = newSource .deriveNewAbstraction (ap , (Stmt ) exitStmt );
687- if (abs != null ) {
688- res .add (abs );
689- if (!abs .equals (calleeD1 ))
690- for (Abstraction callerD1 : callerD1s )
691- manager .getAliasing ().computeAliases (callerD1 , iCallStmt , callerBaseLocal ,
692- res , interproceduralCFG ().getMethodOf (iCallStmt ), abs );
674+ if (isExecutorExecute ) {
675+ if (manager .getTypeUtils ().checkCast (source .getAccessPath (),
676+ ie .getArg (0 ).getType ())) {
677+ AccessPath ap = manager .getAccessPathFactory ().copyWithNewValue (source .getAccessPath (),
678+ ie .getArg (0 ));
679+ Abstraction abs = source .deriveNewAbstraction (ap , (Stmt ) exitStmt );
680+ if (abs != null )
681+ res .add (abs );
682+ }
683+ } else if (iCallStmt .getInvokeExpr () instanceof InstanceInvokeExpr ) {
684+ // Type check
685+ if (manager .getTypeUtils ().checkCast (source .getAccessPath (), thisLocal .getType ())) {
686+ InstanceInvokeExpr iIExpr = (InstanceInvokeExpr ) iCallStmt .getInvokeExpr ();
687+
688+ // Get the caller-side base local
689+ // and create a new access path for it
690+ Value callerBaseLocal = isReflectiveCallSite
691+ ? iIExpr .getArg (0 )
692+ : iIExpr .getBase ();
693+ AccessPath ap = manager .getAccessPathFactory ().copyWithNewValue (
694+ newSource .getAccessPath (), callerBaseLocal ,
695+ isReflectiveCallSite ? null : newSource .getAccessPath ().getBaseType (),
696+ false );
697+ Abstraction abs = newSource .deriveNewAbstraction (ap , (Stmt ) exitStmt );
698+ if (abs != null ) {
699+ res .add (abs );
700+ if (!abs .equals (calleeD1 ))
701+ for (Abstraction callerD1 : callerD1s )
702+ manager .getAliasing ().computeAliases (callerD1 , iCallStmt , callerBaseLocal ,
703+ res , interproceduralCFG ().getMethodOf (iCallStmt ), abs );
704+ }
693705 }
694706 }
695707 }
0 commit comments