pracio / dex2jar

Automatically exported from code.google.com/p/dex2jar
0 stars 0 forks source link

Bug when translating instruction which stores a value to an array initialized to null (similar to 120,122 issues) #123

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Write the following Java snippet

    int[]a = null;
    a[1] = 99;

2. Compile down to dex:

    const/4 v0, 0x0
    const/4 v1, 0x1
    const/16 v2, 0x63
    aput v2, v0, v1

3. Use dex2jar to get the jar

What is the expected output? What do you see instead?

I get: 

   0:   iconst_0
   1:   iconst_1
   2:   bipush  99
   4:   iastore
   5:   return

I should get:

   0:   aconst_null
   1:   iconst_1
   2:   bipush  99
   4:   iastore
   5:   return

What version of the product are you using? On what operating system?
Latest version of 0.0.9.x branch.

Please provide any additional information below.

I have attached a small patch that fixes the above problem. It is a fix to the 
LocalType.java file ( one extra line of code on line 192 ) which is very 
similar to your solution to issue 120. But there seems to be a new bug 
introduced by these 2 fixes (separately and collectively). I will report it as 
a separate issue.

Original issue reported on code.google.com by O.Tsapo...@gmail.com on 12 Jun 2012 at 6:32

Attachments:

GoogleCodeExporter commented 9 years ago
I mistakenly said that a new issue ( 124 ) is introduced by the fix for issue 
120 but I was wrong. Issue 124 does not depend on the above.

Original comment by O.Tsapo...@gmail.com on 12 Jun 2012 at 10:18