[Soot-list] invokespecial side effects
Bodden, Eric
eric.bodden at sit.fraunhofer.de
Tue Nov 5 11:12:17 EST 2013
Hi Daniel.
I have to agree with Marc-Andre here. s3 cannot possibly modify $r2. You must be misinterpreting something.
Eric
On 04.11.2013, at 03:41, Marc-André Laverdière-Papineau <marc-andre.laverdiere-papineau at polymtl.ca> wrote:
> Hello Daniel,
>
> The examples you show are running the constructor. While they do change
> the state of the object, they do not affect the def, as the local is not
> re-defined. This is exactly what I would expect. Am I missing something?
>
> I would expect them to be in the uses though - are they?
>
> Marc-André Laverdière-Papineau
> Doctorant - PhD Candidate
>
> On 31/10/13 12:38 PM, Daniel Luchaup wrote:
>> Hello,
>>
>> I was wondering what is the best practice to deal with the side-effects
>> of invokespecial; they are not listed as results.
>>
>> Ideally each jimple statement that modifies a local should specify that
>> local as a result.
>> However, that is not the case for invokespecial. For instance (see
>> complete example at the end of the email):
>> ..............
>> (s1:) $r2 = new java.lang.StringBuilder;
>> (s2:) $r3 = ...
>> (s3:) specialinvoke $r2.<java.lang.StringBuilder: void
>> <init>(java.lang.String)>($r3);
>> (s4:) use($r2);
>> .............
>> If I use SmartLocalDefs.getDefsOfAt($r2, (s2)), I get s1, but in fact
>> $r2 was last modified at s3.
>> It seems that, at least in this case, specialinvoke should have a result:
>> (s3:) $rX = specialinvoke $r2.<java.lang.StringBuilder: void
>> <init>(java.lang.String)>($r3);
>>
>> So, to get the real definition of $r2 that reaches (s4:) one would have
>> to explicitly reason about the above code pattern.
>>
>> Can this be done better?
>>
>> Thank you
>> Daniel
>>
>> P.S. FYI: A more complete example:
>> The jimple code for 'String copy1(String s1) { return s1+"!!!";}' contains:
>>>>>>>
>> r0 := @this: dummy;
>> r1 := @parameter0: java.lang.String;
>> $r2 = new java.lang.StringBuilder;
>> $r3 = staticinvoke <java.lang.String: java.lang.String
>> valueOf(java.lang.Object)>(r1);
>> specialinvoke $r2.<java.lang.StringBuilder: void
>> <init>(java.lang.String)>($r3);
>> $r4 = virtualinvoke $r2.<java.lang.StringBuilder:
>> java.lang.StringBuilder append(java.lang.String)>("!!!");
>> $r5 = virtualinvoke $r4.<java.lang.StringBuilder:
>> java.lang.String toString()>();
>> return $r5;
>> <<<<<
>>
>>
>>
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at sable.mcgill.ca
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
--
Prof. Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering at Fraunhofer SIT, TU Darmstadt and EC SPRIDE
Tel: +49 6151 16-75422 Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
More information about the Soot-list
mailing list