[Soot-list] Question regarding Java Bytecode
Bernhard Berger
berber at tzi.de
Fri Dec 2 01:23:57 EST 2011
Hi everybody,
today soot greeted me with a nice exception located somewhere deep in
the coffie-source. Since the bytecode I am analyzing is not generated by
a default java compiler the Bytecode might be the culprit. The stack
trace is the following one:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
at soot.coffi.ByteCode.locateInstr(ByteCode.java:1104)
at soot.coffi.ByteCode.locateInstr(ByteCode.java:1108)
at soot.coffi.ByteCode.locateInstr(ByteCode.java:1108)
at soot.coffi.ByteCode.locateInst(ByteCode.java:1097)
at soot.coffi.ClassFile.parseMethod(ClassFile.java:1248)
at soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:78)
at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:82)
at soot.SootMethod.retrieveActiveBody(SootMethod.java:315)
at soot.PackManager.retrieveAllBodies(PackManager.java:989)
at soot.PackManager.runPacks(PackManager.java:338)
at soot.Main.run(Main.java:198)
at soot.Main.main(Main.java:141)
I took a look at the method's Bytecode and its exception table sind soot
handles links exception table to the corresponding Bytecode instructions
at this point. I think the Bytecode is not correct at this point but I'm
not a Bytecode expert. Perhaps someone can support my theory.
javap gives me the following output for the method in question:
public java.lang.String getPluginsPath();
Code:
0: aload_0
1: monitorenter
2: aload_0
3: monitorexit
4: ldc #209; //String
6: areturn
Exception table:
from to target type
2 2 7 any
I consulted the JVM-spec and it states for the exception table:
The value of the handler_pc (target in this case) item indicates the
start of the exception handler. The value of the item must be a valid
index into the code array and must be the index of the opcode of an
instruction.
Therefore the Bytecode is not corret, since the handler_pc does not
point to a valid address. Am I correct? If the Bytecode is invalid I am
going to blame the author of the tool that generated the Bytecode. :-)
Regards from Bremen, Germany
Bernhard
More information about the Soot-list
mailing list