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

John Dean jdean4 at kc.rr.com
Mon Jul 30 21:18:41 EDT 2012


Hi all,

I haven't heard back from anyone about my question below. I'll give it
another half day or so, and if I don't hear from anyone, I'll probably
proceed with this strategy:

For the set of statements that I'm interested in (statements in a loop),
I'll look for array references at the left of assignment statements, and for
each such array reference, I'll search for definitions of the array
references' bases (arr[i]'s base is arr) and follow such definitions until I
reach a newarray Jimple value. During that recursive traversal process, if I
run into any array bases that were found previously, then that's an
indication of overlapping arrays.

Before I proceed with that rather complicated strategy, if anyone knows of a
simpler solution or has advice, please share.

Thanks,
John

-----Original Message-----
From: soot-list-bounces at sable.mcgill.ca
[mailto:soot-list-bounces at sable.mcgill.ca] On Behalf Of John Dean
Sent: Sunday, July 29, 2012 10:19 PM
To: soot-list at sable.mcgill.ca
Subject: [Soot-list] How can I tell if the two arrays overlap?

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

_______________________________________________
Soot-list mailing list
Soot-list at sable.mcgill.ca
http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list



More information about the Soot-list mailing list