[Soot-list] Erroneous array dimensions in Dex output?

Julian Schütte julian.schuette at gmx.net
Mon Jan 6 13:08:21 EST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ah, that easy :-)

Thanks a lot!
Julian

On 06.01.2014 11:40, Alexandre Bartel wrote:
> Hi Julian,
>
> The jimple code should be something like the following when creating a
> String array:
>
> $r1 = newarray (java.lang.String)[0];
>
> When you create a new array in Jimple using newNexArrayExpr, the first
> parameter should be the type of the array elements not the type of the
> array.
>
> /Alexandre
> 
> On Sat, 2014-01-04 at 23:37 +0100, Julian Schütte wrote:
>> Hi all,
>>
>> I am quite new to Soot, so I don't know if I'm running into a bug in
>> Soot/dexpler or if I'm doing sth wrong.
>> When creating an array of Strings in Soot, Dexpler seems to add one more
>> dimension than requested. As creating a 0-dimensional array results in a
>> RuntimeException in soot, this prevents me from creating a 1-dimensional
>> array in dex.
>>
>> Usage:
>>    ArrayType arrayType = ArrayType.v(soot.RefType.v("java.lang.String"),
>> 1);    // EXPECTING: One-dimensional array String[]
>>    Local array = Jimple.v().newLocal("myArray", arrayType);
>>    body.getLocals().add(array);
>>    NewArrayExpr newArrayExpr = Jimple.v().newNewArrayExpr(arrayType,
>> IntConstant.v(0));
>>    AssignStmt assignStmt = Jimple.v().newAssignStmt(array, newArrayExpr);
>>    generated.add(assignStmt);
>>    ...
>>    body.getUnits().insertBefore(generated, u);
>>
>> Jimple output looks good:
>>    myArray = newarray (java.lang.String[])[0];
>>
>> Dex output does not look good:
>>     new-array v0, v8, [[Ljava/lang/String;     // GOT: Two-dimensional
>> array String[][]
>>     move-object/from16 v18, v0                  // ??
>>     move-object/from16 v0, v18
>>
>>
>> Thanks for your help!
>> Julian
>>
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at sable.mcgill.ca
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>

- -- 
Please use PGP! My Key ID is 0xF92B3072, Fingerprint: 9B7C 4A37 6D56
3FAB 8B90 C797 2991 DA5F F92B 3072
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJSyvEVAAoJECmR2l/5KzByo+AQAJYYfi+hoORZ5wcOj9eLHenj
wlW+2Sgoy8aNU16OWEIILe1ijLrET00QlM2gxhGi0+BjpBX+KP1h8o50rQ0d84La
M/Yoa1Q+0oVCWwGP4r3elKBFtPrKjoMjCuJvhhjyBhadFtduqbiZs22vf3tJ4t1o
WVpSpuuDrKQekIS42tQ5wVBj84fOPr6yRYWfIU92OQp7QuysVd788AFLsIQbFsGO
65JfqnXL8CzPwCpvzYWm2u9RTnRutOXeHHJrIeWuKs5Z0wH8MyBzcFUQY2e9Z5jb
yuMZFI2l81YZw/apxcP7pGDzoobsONNTlhOcn9SaGZCzAUxCsW8hA75YPkclALMm
J+9CBt3FwdUEeB6fNFnM9KPYUlDonlOrWqsFhvDdtRbJAUrvduS9b2nVZp+0fgEy
j41hMcVEnLsLqrIpiDDVtdwSjKUtGYRLNhhyfsU0ELfNhi42ukoCSfEAQstgEcbN
axigk0iQvOdX+SIoutrKwIzMehvFvibOQZ+HchXlZx0CMwHKGlKj5NkFveBwTn7q
RvEApef0YxzuHf4LP6NF6gcaqhWlNJH9A/xtcQEQ+8dbMKn3e4R91B9QPxIjVzej
rZj0Eh5u0gopdISOOD6728ocwuxqTscrQ13gqImN/4izN3aK5yBdaP0EUXA/kGTf
bY+/HTawnTwDmH3AyQzF
=L46u
-----END PGP SIGNATURE-----



More information about the Soot-list mailing list