WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 1a7df22

Browse files
committed
Fix "failed to determine the array type" in case the primitive array is a method parameter
1 parent fad8f43 commit 1a7df22

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/java/soot/dexpler/DexFillArrayDataTransformer.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@
4848
import soot.dexpler.typing.UntypedConstant;
4949
import soot.jimple.ArrayRef;
5050
import soot.jimple.AssignStmt;
51+
import soot.jimple.IdentityStmt;
5152
import soot.jimple.InvokeExpr;
5253
import soot.jimple.NewArrayExpr;
54+
import soot.jimple.ParameterRef;
5355
import soot.toolkits.graph.ExceptionalUnitGraph;
5456
import soot.toolkits.graph.ExceptionalUnitGraphFactory;
5557
import soot.toolkits.scalar.LocalDefs;
@@ -96,12 +98,12 @@ protected void internalTransform(final Body body, String phaseName, Map<String,
9698
List<Type> arrayTypes = new LinkedList<>();
9799
checkArrayDefinitions(l, ass, defs, arrayTypes, MAX_RECURSION_DEPTH);
98100
if (arrayTypes.isEmpty()) {
99-
throw new InternalError("Failed to determine the array type ");
101+
throw new InternalError("Failed to determine the array type of " + l + " in method " + body.getMethod());
100102
}
101103
if (arrayTypes.size() > 1) {
102104
arrayTypes = arrayTypes.stream().distinct().collect(Collectors.toList());
103105
if (arrayTypes.size() > 1) {
104-
logger.warn("Found multiple possible array types, using first ignoreing the others: {}", arrayTypes);
106+
logger.warn("Found multiple possible array types, using first ignoring the others: {}", arrayTypes);
105107
}
106108
}
107109

@@ -159,8 +161,11 @@ private void checkArrayDefinitions(Local l, Unit u, LocalDefs defs, List<Type> a
159161
} else {
160162
throw new InternalError("Unsupported array definition statement: " + d);
161163
}
164+
} else if (d instanceof IdentityStmt) {
165+
IdentityStmt is = (IdentityStmt) d;
166+
ParameterRef pRef = (ParameterRef) is.getRightOpBox().getValue();
167+
arrayTypes.add(((ArrayType) pRef.getType()).getArrayElementType());
162168
}
163169
}
164-
165170
}
166171
}

0 commit comments

Comments
 (0)