Skip to content

Endless loop in soot.jimple.toolkits.typing.fast.TypeResolver.typePromotion() #2185

@jpstotz

Description

@jpstotz

Please examine each of the following points so that we can help you as soon and best as possible.

Describe the bug

When trying to load the body of a certain method Soot ends up in an endless loop soot.jimple.toolkits.typing.fast.TypeResolver.typePromotion()

VisualVM shows where soot is stuck:
Image

Input file
The affected APK, stripped down to the relevant classes.dex file (the original has 21 dex files)
tt dex only.apk.zip

To reproduce

Load the APK into soot (latest develop branch) and try to load the body of method u in class X.Da5.
I have used this test code:

String classToLoad = "X.Da5";
String methodToLoad = "u";
File apkFile = new File("tt dex only.apk");

Options o = Options.v();
o.set_exclude(Collections.emptyList());
o.set_verbose(true);
o.set_process_multiple_dex(true);
o.set_no_bodies_for_excluded(true);
o.set_allow_phantom_refs(true);
o.set_whole_program(true);
o.set_process_dir(List.of(apkFile.getAbsolutePath()));
o.set_prepend_classpath(false);
o.set_process_multiple_dex(true);

o.set_android_jars(ANDROID_JARS_DIR);
o.set_src_prec(Options.src_prec_apk);

Main.v().autoSetOptions();
Scene.v().loadNecessaryClasses();
System.out.println("loadNecessaryClasses finished");

SootClass sootClass = Scene.v().getSootClass(classToLoad);
List<SootMethod> allMethods = sootClass.getMethods();
List<SootMethod> selectedMethods = allMethods.stream().filter(m -> methodToLoad.equals(m.getName())).toList();
if (selectedMethods.isEmpty()) {
	throw new RuntimeException("No method named " + methodToLoad+" in class " + classToLoad); 
}
if (selectedMethods.size()>1) {
	throw new RuntimeException("Multiple methods named " + methodToLoad+" in class " + classToLoad); 
}
SootMethod sm = selectedMethods.get(0);
Body b = sm.retrieveActiveBody();
System.out.println("finished"); // never reached

Expected behavior
Typing finishes at least after a few minutes

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