[Soot-list] bug in soot.jimple.toolkits.Evaluator?

Eric Bodden eric.bodden at mail.mcgill.ca
Thu May 15 12:37:31 EDT 2008


Hi Will.

I finally found the time to fix this. I fixed it like you proposed, by
modifying isValueConstantValued. It's interesting though that this was
triggered in Apple's runtime library, because I think it can only
occur if you call ".length" on a value that is certainly null.

Eric

2007/9/18 Will Benton <willb at cs.wisc.edu>:
> Hello, all.
>
> I've found an odd problem with the Evaluator while trying to run the Shimple
> constant propagator.  getConstantValueOf fails with a RuntimeException if it
> is given a LengthExpr with a null operand (this seems to come up while
> processing the read method of java.util.jar.Manifest in Apple's Java 1.4
> library).  isValueConstantValued returns true on such an expression because
> it is a UnopExpr with a constant operand, but getConstantValueOf doesn't
> handle this case, so it falls through to the throw at the end.
>
> Since invoking arraylength on a null reference will always result in an
> exception, it seems to me that the appropriate change is to add a special
> case to isValueConstantValued so that it will not identify such LengthExprs
> as constant-valued, rather than changing getConstantValueOf.  Is this the
> right approach, or am I missing something?
>
> I'm using soot 2.2.4 (although it looks like this problem still exists in
> the repository).  Since it is unlikely that there is reachable code in the
> Java library that depends on accessing the field of a null reference, I will
> look more closely at the method in Manifest and see if I can identify any
> other problems with constant propagation that lead to this situation.
>
> In any case, I've attached a trivial program that exposes the crash in
> Evaluator -- you should be able to reproduce my crash by running soot on it
> with "-via-shimple" and "-p sop enabled".
>
>
> best,
> wb
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>



-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


More information about the Soot-list mailing list