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

UnitThrowAnalysis StmtSwitch: type of throw argument is not a RefType! occurs when analysing APKs #2083

Open
leileidesu opened this issue May 26, 2024 · 0 comments

Comments

@leileidesu
Copy link

Hello, I'm a beginner at soot, i met a problem when i used soot to analyse APK files.

Describe the bug
When I use soot to analyse APK files, if i added Options.v().setPhaseOption("jb", "use-original-names:true");in the program, I got an error: java.lang.IllegalStateException: UnitThrowAnalysis StmtSwitch: type of throw argument is not a RefType!
I think this bug is the same as the bug reported in Issue 1256.
The code that causes the error is as follows:

    public static void main(String[] args) {
        G.reset();
        Options.v().set_src_prec(Options.src_prec_apk);
        Options.v().set_android_jars("xxxx");
        String apkPath = "xxxx.apk";
        Options.v().set_process_dir(Collections.singletonList(apkPath));
        Options.v().set_allow_phantom_refs(true);
        Options.v().setPhaseOption("jb", "use-original-names:true");
        Scene.v().loadNecessaryClasses();
        PackManager.v().runPacks();
    }

Input file
The error occurs in all the APKs that I have tested.
Here is an example.

Stacktrace
The traceback of the error is as follows:

[Thread-1] ERROR heros.solver.CountingThreadPoolExecutor - Worker thread execution failed: UnitThrowAnalysis StmtSwitch: type of throw argument is not a RefType!
java.lang.IllegalStateException: UnitThrowAnalysis StmtSwitch: type of throw argument is not a RefType!
	at soot.toolkits.exceptions.AbstractThrowAnalysis.mightThrowExplicitly(AbstractThrowAnalysis.java:75)
	at soot.toolkits.exceptions.UnitThrowAnalysis$UnitSwitch.caseThrowStmt(UnitThrowAnalysis.java:844)
	at soot.jimple.internal.JThrowStmt.apply(JThrowStmt.java:67)
	at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:281)
	at soot.toolkits.exceptions.UnitThrowAnalysis.mightThrow(UnitThrowAnalysis.java:276)
	at soot.toolkits.graph.ExceptionalUnitGraph.buildExceptionDests(ExceptionalUnitGraph.java:277)
	at soot.toolkits.graph.ExceptionalUnitGraph.initialize(ExceptionalUnitGraph.java:220)
	at soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph.java:127)
	at soot.toolkits.graph.ExceptionalUnitGraphFactory.newExceptionalUnitGraph(ExceptionalUnitGraphFactory.java:55)
	at soot.toolkits.graph.ExceptionalUnitGraphFactory.createExceptionalUnitGraph(ExceptionalUnitGraphFactory.java:50)
	at soot.toolkits.scalar.LocalSplitter.internalTransform(LocalSplitter.java:109)
	at soot.BodyTransformer.transform(BodyTransformer.java:52)
	at soot.BodyTransformer.transform(BodyTransformer.java:56)
	at soot.dexpler.DexBody.jimplify(DexBody.java:692)
	at soot.dexpler.DexMethod$1.getBody(DexMethod.java:117)
	at soot.SootMethod.retrieveActiveBody(SootMethod.java:447)
	at soot.PackManager.lambda$retrieveAllBodies$2(PackManager.java:1250)

How can I get the original variable names of an APK in Jimple? Thank you for your reply.

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

1 participant