[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A Wala crash bug when I set entry point #1389

Open
tisble opened this issue Apr 7, 2024 · 1 comment
Open

A Wala crash bug when I set entry point #1389

tisble opened this issue Apr 7, 2024 · 1 comment

Comments

@tisble
Copy link
tisble commented Apr 7, 2024

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.
image

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)
@msridhar
Copy link
Member

@tisble is there any way you could put together a standalone github repo that reproduces this crash? That would help me debug it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants