Skip to content

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

Open
@leileidesu

Description

@leileidesu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions