Skip to content

Commit 2a6649a

Browse files
authored
Merge pull request #826 from MarcMil/improve-code
ICCRedirectionCreator: Handle cases with implicit intents
2 parents 6fa02d9 + 9cd40b1 commit 2a6649a

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

soot-infoflow-android/src/soot/jimple/infoflow/android/iccta/IccRedirectionCreator.java

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -194,21 +194,27 @@ protected SootMethod generateRedirectMethodForStartActivityForResult(SootClass o
194194
Local intentParameterLocal = lg.generateLocal(INTENT_TYPE);
195195
b.getUnits().add(Jimple.v().newIdentityStmt(intentParameterLocal, Jimple.v().newParameterRef(INTENT_TYPE, 1)));
196196

197+
Value arIntentLocal;
197198
// call onCreate
198-
Local componentLocal = lg.generateLocal(destComp.getType());
199-
{
200-
SootMethod targetDummyMain = componentToEntryPoint.getEntryPoint(destComp);
201-
if (targetDummyMain == null)
202-
throw new RuntimeException(
203-
String.format("Destination component %s has no dummy main method", destComp.getName()));
204-
b.getUnits().add(Jimple.v().newAssignStmt(componentLocal, Jimple.v()
205-
.newStaticInvokeExpr(targetDummyMain.makeRef(), Collections.singletonList(intentParameterLocal))));
206-
}
199+
if (destComp != null) {
200+
Local componentLocal = lg.generateLocal(destComp.getType());
201+
{
202+
SootMethod targetDummyMain = componentToEntryPoint.getEntryPoint(destComp);
203+
if (targetDummyMain == null)
204+
throw new RuntimeException(
205+
String.format("Destination component %s has no dummy main method", destComp.getName()));
206+
b.getUnits().add(Jimple.v().newAssignStmt(componentLocal, Jimple.v().newStaticInvokeExpr(
207+
targetDummyMain.makeRef(), Collections.singletonList(intentParameterLocal))));
208+
}
207209

208-
// Get the activity result
209-
Local arIntentLocal = lg.generateLocal(INTENT_TYPE);
210-
b.getUnits().add(Jimple.v().newAssignStmt(arIntentLocal, Jimple.v().newInterfaceInvokeExpr(componentLocal,
211-
componentToEntryPoint.getComponentExchangeInfo().getResultIntentMethod.makeRef())));
210+
// Get the activity result
211+
arIntentLocal = lg.generateLocal(INTENT_TYPE);
212+
b.getUnits().add(Jimple.v().newAssignStmt(arIntentLocal, Jimple.v().newInterfaceInvokeExpr(componentLocal,
213+
componentToEntryPoint.getComponentExchangeInfo().getResultIntentMethod.makeRef())));
214+
} else {
215+
//Nonetheless, we want to have onActivityResult in the call graph.
216+
arIntentLocal = NullConstant.v();
217+
}
212218

213219
// some apps do not have an onActivityResult method even they use
214220
// startActivityForResult to communicate with other components.

0 commit comments

Comments
 (0)