[Soot-list] Fix for IndexOutOfBoundsException in ForLoopCreationHelper

Steffen Pingel steffenp at gmx.de
Sat Jan 14 20:42:43 EST 2006


Hi,

I have observed an IndexOutOfBoundsException that is caused by a bug in 
ForLoopCreationHelper while trying to decompile Soot [1]. I have attached a 
simple example that demonstrats the bug [2]. See below for stack trace [3].

The exception is thrown when getUpdate(defs,condUses,commonVars) is invoked in 
checkPattern() and the following conditions are true:

 * getUpdate() removes the update statement
 * createNewStmtSeqNodeAndGetInit() returns an empty list

This causes checkPattern() to return and to fail on the next time it is called 
by ForLoopCreator, since it discovers the same loop but the update statement 
is missing this time.

Steffen


[1] Soot was compiled and run with Eclipse 3.1.1 using JDK 1.4.2_06
[2] Running "java soot.Main -f d soot.jimple.spark.pag.PAG" 
also triggers the bug
[3] Stack trace:

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: -1, 
Size: 0
        at java.util.LinkedList.entry(LinkedList.java:368)
        at java.util.LinkedList.get(LinkedList.java:313)
        at 
soot.dava.toolkits.base.AST.transformations.ForLoopCreationHelper.getUpdate(ForLoopCreationHelper.java:307)
        at 
soot.dava.toolkits.base.AST.transformations.ForLoopCreationHelper.checkPattern(ForLoopCreationHelper.java:235)
        at 
soot.dava.toolkits.base.AST.transformations.ForLoopCreator.normalRetrieving(ForLoopCreator.java:94)
        at 
soot.dava.toolkits.base.AST.analysis.DepthFirstAdapter.caseASTMethodNode(DepthFirstAdapter.java:61)
        at soot.dava.internal.AST.ASTMethodNode.apply(ASTMethodNode.java:331)
        at soot.dava.DavaBody.<init>(DavaBody.java:291)
        at soot.dava.Dava.newBody(Dava.java:81)
        at soot.PackManager.runBodyPacks(PackManager.java:656)
        at soot.PackManager.runBodyPacks(PackManager.java:428)
        at soot.PackManager.runBodyPacks(PackManager.java:371)
        at soot.PackManager.runPacks(PackManager.java:366)
        at soot.Main.run(Main.java:179)
        at soot.Main.main(Main.java:153)


-- 
Steffen Pingel - steffenp at gmx.de - http://steffenpingel.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Example8.java
Type: text/x-java
Size: 662 bytes
Desc: not available
Url : http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20060115/dbbed7cd/Example8.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: soot-2260-lost-update-statement.diff
Type: text/x-diff
Size: 2181 bytes
Desc: not available
Url : http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20060115/dbbed7cd/soot-2260-lost-update-statement.bin


More information about the Soot-list mailing list