@@ -570,7 +570,8 @@ private Set<Abstraction> computeTargetsInternal(Abstraction d1, Abstraction sour
570570 if (abs != null )
571571 res .add (abs );
572572 }
573- } else if (ie != null && dest .getParameterCount () > 0 ) {
573+ } else if (ie != null && dest .getParameterCount () > 0
574+ && (isReflectiveCallSite || ie .getArgCount () == dest .getParameterCount ())) {
574575 for (int i = isReflectiveCallSite ? 1 : 0 ; i < ie .getArgCount (); i ++) {
575576 if (!aliasing .mayAlias (ie .getArg (i ), source .getAccessPath ().getPlainValue ()))
576577 continue ;
@@ -588,17 +589,18 @@ private Set<Abstraction> computeTargetsInternal(Abstraction d1, Abstraction sour
588589 if (interproceduralCFG ().methodWritesValue (dest , paramLocals [i ]))
589590 continue ;
590591
591- // taint all parameters if reflective call site
592592 if (isReflectiveCallSite ) {
593+ // taint all parameters if the arg array of an reflective
594+ // call site is tainted
593595 for (Value param : paramLocals ) {
594596 AccessPath ap = manager .getAccessPathFactory ()
595597 .copyWithNewValue (source .getAccessPath (), param , null , false );
596598 Abstraction abs = source .deriveNewAbstraction (ap , stmt );
597599 if (abs != null )
598600 res .add (abs );
599601 }
600- // taint just the tainted parameter
601602 } else {
603+ // taint just the tainted parameter
602604 AccessPath ap = manager .getAccessPathFactory ()
603605 .copyWithNewValue (source .getAccessPath (), paramLocals [i ]);
604606 Abstraction abs = source .deriveNewAbstraction (ap , stmt );
@@ -609,6 +611,12 @@ private Set<Abstraction> computeTargetsInternal(Abstraction d1, Abstraction sour
609611 }
610612 }
611613
614+ // Sometimes callers have more arguments than the callee parameters, e.g.
615+ // because one argument is resolved in native code. A concrete example is
616+ // sendMessageDelayed(android.os.Message, int)
617+ // -> handleMessage(android.os.Message message)
618+ // TODO: handle argument/parameter mismatch for some special cases
619+
612620 return res ;
613621 }
614622 };
0 commit comments