Skip to content

Commit f3d6eb2

Browse files
committed
Fix adding the statement multiple times
1 parent 5100c2d commit f3d6eb2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

soot-infoflow-android/src/soot/jimple/infoflow/android/AndroidLibraryClassPatcher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected String[] getAllNames(String className) {
8484
return names.toArray(new String[names.size()]);
8585
}
8686

87-
private void patchInstantiate(SootClass sc, String subsig, String... name) {
87+
protected void patchInstantiate(SootClass sc, String subsig, String... names) {
8888

8989
if (!sc.isLibraryClass())
9090
sc.setLibraryClass();
@@ -111,7 +111,7 @@ private void patchInstantiate(SootClass sc, String subsig, String... name) {
111111

112112
Local cmp = null;
113113
NopStmt next = null;
114-
for (String n : name) {
114+
for (String n : names) {
115115
if (n != null) {
116116
RefType p = RefType.v(n);
117117
if (p.hasSootClass() && p.getSootClass().isApplicationClass()) {

soot-infoflow-android/src/soot/jimple/infoflow/android/entryPointCreators/components/AbstractComponentEntryPointCreator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public void assignIntent(SootClass hostComponent, SootMethod method, int indexOf
267267
JimpleBody body = (JimpleBody) method.retrieveActiveBody();
268268

269269
// Some component types such as fragments don't have a getIntent() method
270-
SootMethod m = hostComponent.getMethodUnsafe("android.content.Intent getIntent()");
270+
SootMethod m = hostComponent.getMethodUnsafe(componentExchangeInfo.getIntentMethod.getSubSignature());
271271
if (m != null) {
272272
UnitPatchingChain units = body.getUnits();
273273
Local thisLocal = body.getThisLocal();
@@ -277,7 +277,8 @@ public void assignIntent(SootClass hostComponent, SootMethod method, int indexOf
277277
for (Iterator<Unit> iter = units.snapshotIterator(); iter.hasNext();) {
278278
Stmt stmt = (Stmt) iter.next();
279279
if (stmt.getTag(SimulatedCodeElementTag.TAG_NAME) != null) {
280-
if (stmt.containsInvokeExpr() && stmt.getInvokeExpr().getMethod().equals(m))
280+
if (stmt.containsInvokeExpr()
281+
&& stmt.getInvokeExpr().getMethod().equals(componentExchangeInfo.getIntentMethod))
281282
return;
282283
}
283284
}
@@ -293,7 +294,7 @@ public void assignIntent(SootClass hostComponent, SootMethod method, int indexOf
293294
* com.google.android.gcm.GCMBroadcastReceiver
294295
*/
295296
Unit setIntentU = Jimple.v().newAssignStmt(intentV,
296-
Jimple.v().newVirtualInvokeExpr(thisLocal, m.makeRef()));
297+
Jimple.v().newVirtualInvokeExpr(thisLocal, componentExchangeInfo.getIntentMethod.makeRef()));
297298

298299
setIntentU.addTag(SimulatedCodeElementTag.TAG);
299300
units.insertBefore(setIntentU, stmt);

0 commit comments

Comments
 (0)