[Soot-list] How can I tell if the two arrays overlap?

John Dean jdean4 at kc.rr.com
Sun Jul 29 23:19:02 EDT 2012


Hi,

If there are two array references with different names for the two arrays,
how can I tell if the two arrays overlap (for example, one array is
2-dimensional, and the other array is a row inside the first array)?

I've searched through the soot api for clues, but I haven't find anything
suitable yet. If I was working with Java source code instead of Jimple, I
would call arr1.containsAll(arr1), but there's nothing comparable in soot,
as far as I can tell. I realize that soot is a static analysis tool, so it
won't allow me to find an array element's value.

I think I know how to retrieve the array references and end up with
JArrayRef variables, and I can call JArrayRef's getBase and getIndex methods
to get the array variable name and the index, respectively, but I don't know
how that helps me.

Maybe if I could somehow get the size of each array and get the starting
address of each array, then I suppose I could use that information to tell
if the arrays overlapped. That sounds wrong, but maybe not?

Or maybe I should use each array's retrieved base and then search for
definitions of the bases and "chase" the definitions back to see if they
intersect. That sounds like a lot of work, and I don't know if it's even
possible.

Any advice would be greatly appreciated.

Thanks,
John



More information about the Soot-list mailing list