[Soot-list] ClassFormatError: Truncated class file

José Leal Domingues Neto dominguesn at gmail.com
Thu Oct 1 12:05:29 EDT 2015


Hello everyone,

I'm getting the following error when trying to use soot to alter some class
file.

neto at boom ~/prj/Instrument/sootOutput 0 <λ [ java br.com.lealdn.Testing

             master * ] 12:58
Error: A JNI error has occurred, please check your installation and try
again
Exception in thread "main" java.lang.ClassFormatError: Truncated class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)

The Soot lib used is the latest in github, with the following program:

        Options.v().set_src_prec(Options.src_prec_java);
        Options.v().set_output_format(Options.output_format_class);
        Options.v().parse(new String[] { "-pp", "-process-dir",
"/home/neto/prj/Instrument/bin",  "-allow-phantom-refs", "-w" });
        Scene.v().loadClassAndSupport("java.lang.Object");
        Scene.v().loadClassAndSupport("java.lang.System");
        Scene.v().loadNecessaryClasses();

        SootClass c = Scene.v().forceResolve("br.com.lealdn.Testing",
SootClass.BODIES);
        Scene.v().loadNecessaryClasses();
        PackManager.v().writeOutput();

I then execute the new create class files with:
neto at boom ~/prj/Instrument/sootOutput 0 <λ [ java br.com.lealdn.Testing

And get the error. Previously I was getting a "no active body" in method
<init> for some classes. I fixed that by changing AbstractJasminClass and
adding a:

method.retrieveActiveBody();

in method "emitMethod". That solved the problem temporarily.

I'm I doing this in the correct way?

Thanks,
José
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20151001/9266c670/attachment.html 


More information about the Soot-list mailing list