[Soot-list] Dava crash when decompiling org.objectweb.asm.ClassReader

Tal Weiss talw.gx at gmail.com
Mon Apr 23 08:20:52 EDT 2012


Hi all,

I'm testing out Dava for a project we're working on and was working with
the Dava Eclipse plug-in to decompile the open source ASM library's
classReader as a test (using both .java and .class as input). The plug-in
and a small test app I built both crashed with the
same NullPointerException run-time exception.

Here's the Eclipse plug-in console output -

"Starting from Soot's class library:
soot.Main --f d --d C:\Sparktale\WorkspaceNew\ASM\sootOutput --cp
/C:/Program%20Files/Java/jdk1.6.0_30/jre/lib/ext/dnsns.jar;/C:/ASM/src;/C:/Program%20Files/Java/jdk1.6.0_30/jre/lib/ext/localedata.jar;/C:/Program%20Files/Java/jdk1.6.0_30/jre/lib/ext/sunjce_provider.jar;/C:/Program%20Files/Java/jdk1.6.0_30/jre/lib/jsse.jar;/C:/Program%20Files/Java/jdk1.6.0_30/jre/lib/jce.jar;/C:/Program%20Files/Java/jdk1.6.0_30/jre/lib/rt.jar;/C:/Program%20Files/Java/jdk1.6.0_30/jre/lib/resources.jar;/C:/Program%20Files/Java/jdk1.6.0_30/jre/lib/charsets.jar;/C:/Sparktale/WorkspaceNew/ASM/bin/;;C:\Sparktale\WorkspaceNew\ASM\src;C:\Program
Files\Java\jdk1.6.0_30\jre\lib\resources.jar;C:\Program
Files\Java\jdk1.6.0_30\jre\lib\rt.jar;C:\Program
Files\Java\jdk1.6.0_30\jre\lib\jsse.jar;C:\Program
Files\Java\jdk1.6.0_30\jre\lib\jce.jar;C:\Program
Files\Java\jdk1.6.0_30\jre\lib\charsets.jar;C:\Program
Files\Java\jdk1.6.0_30\jre\lib\ext\dnsns.jar;C:\Program
Files\Java\jdk1.6.0_30\jre\lib\ext\localedata.jar;C:\Program
Files\Java\jdk1.6.0_30\jre\lib\ext\sunjce_provider.jar --xml-attributes
org.objectweb.asm.ClassReader
Soot started on Mon Apr 23 14:58:35 IDT 2012

Decompiling org.objectweb.asm.ClassReader...
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
at ca.mcgill.sable.soot.launching.SootThread.run(SootThread.java:138)
Caused by: java.lang.NullPointerException
at soot.dava.internal.SET.SETNode.find_StatementSequences(SETNode.java:228)
at soot.dava.internal.SET.SETNode.find_StatementSequences(SETNode.java:232)
 at soot.dava.internal.SET.SETNode.find_StatementSequences(SETNode.java:232)
at
soot.dava.toolkits.base.finders.SequenceFinder.find(SequenceFinder.java:38)
 at soot.dava.DavaBody.<init>(DavaBody.java:328)
at soot.dava.Dava.newBody(Dava.java:84)
 at soot.PackManager.runBodyPacks(PackManager.java:814)
at soot.PackManager.runBodyPacks(PackManager.java:463)
 at soot.PackManager.runBodyPacks(PackManager.java:380)
at soot.PackManager.runPacks(PackManager.java:357)
 at soot.Main.run(Main.java:198)
at soot.Main.main(Main.java:141)
... 5 more"


For convenience, this is the source code of the method that caused
the exception. The local variable children is returned as null from
the body2childChain map and causes the exception when dereferenced 2 lines
later.

I've attached the .toString() values of the body and davaBody variables
from the debugger at the moment of exception in the attached file.

 public void find_StatementSequences( SequenceFinder sf, DavaBody davaBody)
    {
Iterator<IterableSet> sbit = subBodies.iterator();
while (sbit.hasNext()) {

    IterableSet body = sbit.next();
    IterableSet children = body2childChain.get( body);
    HashSet<AugmentedStmt> childUnion = new HashSet<AugmentedStmt>();

    Iterator cit = children.iterator();
    while (cit.hasNext()) {
SETNode child = (SETNode) cit.next();

 child.find_StatementSequences( sf, davaBody);
childUnion.addAll( child.get_Body());
    }

    sf.find_StatementSequences( this, body, childUnion, davaBody);
 }
    }


I'm curious whether someone has experienced this before and whether a
solution is available.

Thanks,

Tal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120423/ee6b378d/attachment.html 
-------------- next part --------------
body - 

(goto [?= l9 = this.<org.objectweb.asm.ClassReader: int readUnsignedShort(int)>(l4 + 6)] @ 1394618573)
(l9 = this.<org.objectweb.asm.ClassReader: int readUnsignedShort(int)>(l4 + 6) @ 1717833053)
(l10 = l4 + 8 @ 849971503)
(l6 = 0 @ 409831077)
    
	
davabody -
	
	private void a(org.objectweb.asm.ClassWriter, org.objectweb.asm.Item[], char[])
    {
        org.objectweb.asm.ClassReader this;
        org.objectweb.asm.ClassWriter l1;
        org.objectweb.asm.Item[] l2;
        char[] l3;
        int l4, l5, l6, l8, l9, l10, l11, l12, l13, l15;
        java.lang.String l7;
        org.objectweb.asm.Item l14;
        org.objectweb.asm.ByteVector l11;

        this := @this: org.objectweb.asm.ClassReader;
        l1 := @parameter0: org.objectweb.asm.ClassWriter;
        l2 := @parameter1: org.objectweb.asm.Item[];
        l3 := @parameter2: char[];
        l4 = <org.objectweb.asm.ClassReader: int header>;
        l4 = l4 + (8 + (this.<org.objectweb.asm.ClassReader: int readUnsignedShort(int)>(l4 + 6) << 1));
        l5 = this.<org.objectweb.asm.ClassReader: int readUnsignedShort(int)>(l4);
        l4 = l4 + 2;

     label0:
        if l5 > 0 goto label1;

        goto label2;

     label1:
        goto label7;

     label2:
        l6 = this.<org.objectweb.asm.ClassReader: int readUnsignedShort(int)>(l4 + 6);
        l4 = l4 + 8;

     label3:
        if l6 <= 0 goto label4;

        goto label5;

     label4:
        goto label6;

     label5:
        l4 = l4 + (6 + this.<org.objectweb.asm.ClassReader: int readInt(int)>(l4 + 2));
        l6 = l6 + -1;
        goto label3;

     label6:
        l5 = l5 + -1;
        goto label0;

     label7:
        l5 = this.<org.objectweb.asm.ClassReader: int readUnsignedShort(int)>(l4);
        l4 = l4 + 2;

     label8:
        if l5 > 0 goto label9;

        goto label10;

     label9:
        goto label15;

     label10:
        l6 = this.<org.objectweb.asm.ClassReader: int readUnsignedShort(int)>(l4 + 6);
        l4 = l4 + 8;

     label11:
        if l6 <= 0 goto label12;

        goto label13;

     label12:
        goto label14;

     label13:
        l4 = l4 + (6 + this.<org.objectweb.asm.ClassReader: int readInt(int)>(l4 + 2));
        l6 = l6 + -1;
        goto label11;

     label14:
        l5 = l5 + -1;
        goto label8;

     label15:
        l5 = this.<org.objectweb.asm.ClassReader: int readUnsignedShort(int)>(l4);
        l4 = l4 + 2;

     label16:
        if l5 > 0 goto label17;

        goto label18;

     label17:
        goto label30;

     label18:
        l7 = this.<org.objectweb.asm.ClassReader: java.lang.String readUTF8(int,char[])>(l4, l3);
        l8 = this.<org.objectweb.asm.ClassReader: int readInt(int)>(l4 + 2);
        if "BootstrapMethods".<java.lang.String: boolean equals(java.lang.Object)>(l7) == false goto label19;

        goto label20;

     label19:
        goto label29;

     label20:
        l9 = this.<org.objectweb.asm.ClassReader: int readUnsignedShort(int)>(l4 + 6);
        l10 = l4 + 8;
        l6 = 0;

     label21:
        if l6 < l9 goto label22;

        goto label23;

     label22:
        goto label28;

     label23:
        l11 = this.<org.objectweb.asm.ClassReader: java.lang.Object readConst(int,char[])>(this.<org.objectweb.asm.ClassReader: int readUnsignedShort(int)>(l10), l3).<java.lang.Object: int hashCode()>();
        l12 = this.<org.objectweb.asm.ClassReader: int readUnsignedShort(int)>(l10 + 2);
        l13 = l10 + 4;

     label24:
        if l12 <= 0 goto label25;

        goto label26;

     label25:
        goto label27;

     label26:
        l11 = l11 ^ this.<org.objectweb.asm.ClassReader: java.lang.Object readConst(int,char[])>(this.<org.objectweb.asm.ClassReader: int readUnsignedShort(int)>(l13), l3).<java.lang.Object: int hashCode()>();
        l13 = l13 + 2;
        l12 = l12 + -1;
        goto label24;

     label27:
        l14 = new org.objectweb.asm.Item(l6);
        l14.<org.objectweb.asm.Item: void a(int,int)>(l10 - l4 - 8, l11 & 2147483647);
        l15 = l14.<org.objectweb.asm.Item: int j> % l2.length;
        l14.<org.objectweb.asm.Item: org.objectweb.asm.Item k> = l2[l15];
        l2[l15] = l14;
        l10 = l13;
        l6 = l6 + 1;
        goto label21;

     label28:
        l1.<org.objectweb.asm.ClassWriter: int z> = l9;
        l11 = new org.objectweb.asm.ByteVector(l8 + 62);
        l11.<org.objectweb.asm.ByteVector: org.objectweb.asm.ByteVector putByteArray(byte[],int,int)>(<org.objectweb.asm.ClassReader: byte[] b>, l4 + 8, l8 - 2);
        l1.<org.objectweb.asm.ClassWriter: org.objectweb.asm.ByteVector A> = l11;
        return;

     label29:
        l4 = l4 + (6 + l8);
        l5 = l5 + -1;
        goto label16;

     label30:
        return;
    }


More information about the Soot-list mailing list