Open
Description
When I tried to add an entrypoint to the call graph, Wala failed and threw a runtime exception.
The input file is available via a maven link, which is a top popular library in maven.
Setup
AnalysisScope scope = AnalysisScopeReader.instance.makeJavaBinaryAnalysisScope("Path/to/package", exclusionFile);
scope.addToScope("JDK SCOPE");
IClassHierarchy hierarchy = ClassHierarchyFactory.makeWithRoot(scope);
String targetSig="androidx.appcompat.view.SupportMenuInflater$MenuState.readItem(Landroid/util/AttributeSet;)V"
Collection<Entrypoint> result=new ArrayList<>();
for (Iterator<IClass> it = hierarchy.iterator(); it.hasNext(); ) {
IClass klass = it.next();
if(targetSig.contains(klass.getName().toString()){
for (IMethod method : klass.getDeclaredMethods()) {
if (method.getSignature().contains(targetSig)) {
result.add(new DefaultEntrypoint(method, hierarchy)); // crashed here
}
}
}
}
// ......
After an initial investigation, it seems that Wala mistook that there are 2 parameters in the Callsite. Wala assigned j
with -1 and addCall
method returned null to entrypointCallSites.
Then Wala crashed with the following exception log:
Stacktrace
When I set the entry point with new DefaultEntrypoint(method, hierarchy) or new ArgumentTypeEntrypoint(method, hierarchy), the stacktrace is here:
java.lang.IllegalStateException: Could not create entrypoint callsites: 1. [SEVERE] class com.ibm.wala.classLoader.BytecodeClass$ClassNotFoundWarning : Landroid/content/DialogInterface
2. [SEVERE] class com.ibm.wala.classLoader.BytecodeClass$ClassNotFoundWarning : Landroid/content/DialogInterface$OnClickListener
3. [SEVERE] class com.ibm.wala.classLoader.BytecodeClass$ClassNotFoundWarning : Landroid/content/DialogInterface$OnDismissListener
4. [SEVERE] class com.ibm.wala.classLoader.BytecodeClass$ClassNotFoundWarning : Landroid/content/DialogInterface$OnKeyListener
......
at com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder.makeCallGraph(PropagationCallGraphBuilder.java:238)
...
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Metadata
Assignees
Labels
No labels