What happened?
A slightly modified version of the Soot1577Test test case prints the Jimple body of a problematic method:
public static void test() {
AnalysisInputLocation inputLocation =
new ClassFileBasedAnalysisInputLocation(
Paths.get("src/test/resources/soot-1577/g.class"),
"cn.com.chinatelecom.account.api.c",
SourceType.Application);
JavaView view = new JavaView(inputLocation);
MethodSignature sig = JavaIdentifierFactory.getInstance().getMethodSignature("cn.com.chinatelecom.account.api.c.g", "h", "int", Arrays.asList("android.content.Context"));
@NonNull Body body = view.getMethod(sig).get().getBody();
System.out.println(body);
assertEquals(1, view.getClasses().count());
view.getClasses().findFirst().get().getMethods().forEach(SootMethod::getBody);
}
Prints the method body that contains invalid code:
label19:
$stack4 := @caughtexception;
goto label21;
...
label21:
$stack14#1 := @caughtexception;
virtualinvoke $stack14#1.<java.lang.NullPointerException: void printStackTrace()>();
…
catch java.lang.NullPointerException from label07 to label08 with label19;
In this code, the caught exception reference is used twice, since label21 can be reached via label19. Note that label19 is a valid exceptional handler. label21 was never registered as an exceptional handler.
I think that the merge might work properly; the printStackTrace statement can be reached from two different event handlers and prints the corresponding exception's stack trace.
Here is the method's javap output.
javap.txt
The full jimple body of the corresponding method:
Jimple body of SootUp
Legacy Soot does not exhibit the same problem:
Jimple body of Legacy Soot
Version
Latest develop branch
What happened?
A slightly modified version of the
Soot1577Testtest case prints the Jimple body of a problematic method:Prints the method body that contains invalid code:
In this code, the caught exception reference is used twice, since
label21can be reached vialabel19. Note thatlabel19is a valid exceptional handler.label21was never registered as an exceptional handler.I think that the merge might work properly; the
printStackTracestatement can be reached from two different event handlers and prints the corresponding exception's stack trace.Here is the method's javap output.
javap.txt
The full jimple body of the corresponding method:
Jimple body of SootUp
Legacy Soot does not exhibit the same problem:
Jimple body of Legacy Soot
Version
Latest develop branch