Skip to content

Commit 0eb3caf

Browse files
committed
minor performance optimization
1 parent d6bcec5 commit 0eb3caf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

soot-infoflow/src/soot/jimple/infoflow/problems/InfoflowProblem.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -976,18 +976,19 @@ private Set<AccessPath> mapAccessPathToCallee(final SootMethod callee, final Inv
976976

977977
// special treatment for clinit methods - no param mapping
978978
// possible
979+
final int calleeParamCount = callee.getParameterCount();
979980
if (isExecutorExecute) {
980981
if (aliasing.mayAlias(ie.getArg(0), ap.getPlainValue())) {
981982
if (res == null)
982983
res = new HashSet<AccessPath>();
983984
res.add(manager.getAccessPathFactory().copyWithNewValue(ap,
984985
callee.getActiveBody().getThisLocal()));
985986
}
986-
} else if (callee.getParameterCount() > 0) {
987+
} else if (calleeParamCount > 0) {
987988
boolean isReflectiveCallSite = interproceduralCFG().isReflectiveCallSite(ie);
988989

989990
// check if param is tainted:
990-
if (isReflectiveCallSite || ie.getArgCount() == callee.getParameterCount()) {
991+
if (isReflectiveCallSite || ie.getArgCount() == calleeParamCount) {
991992
for (int i = isReflectiveCallSite ? 1 : 0; i < ie.getArgCount(); i++) {
992993
if (aliasing.mayAlias(ie.getArg(i), ap.getPlainValue())) {
993994
if (res == null)
@@ -996,7 +997,7 @@ private Set<AccessPath> mapAccessPathToCallee(final SootMethod callee, final Inv
996997
// Get the parameter locals if we don't have them yet
997998
if (paramLocals == null)
998999
paramLocals = callee.getActiveBody().getParameterLocals()
999-
.toArray(new Local[callee.getParameterCount()]);
1000+
.toArray(new Local[calleeParamCount]);
10001001

10011002
if (isReflectiveCallSite) {
10021003
// Taint all parameters in the callee if the argument array of a reflective
@@ -1021,7 +1022,7 @@ private Set<AccessPath> mapAccessPathToCallee(final SootMethod callee, final Inv
10211022
// Sometimes callers have more arguments than the callee parameters, e.g.
10221023
// because one argument is resolved in native code. A concrete example is
10231024
// sendMessageDelayed(android.os.Message, int)
1024-
// -> handleMessage(android.os.Message message)
1025+
// -> handleMessage(android.os.Message message)
10251026
// TODO: handle argument/parameter mismatch for some special cases
10261027
}
10271028
return res;

0 commit comments

Comments
 (0)