ccgreen13 / androguard

Automatically exported from code.google.com/p/androguard
Apache License 2.0
0 stars 0 forks source link

rem-long/2addr is improperly decompiled #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
rem-long/2addr is improperly decompiled as multiplication, instead of modulo.  
For example:

calculateChecksum-BB@0x0 : 
    0       (00000000) const-wide/32        v8, 1000000 # [1000000.0]
    1       (00000006) const-wide/16        v6, 1000 # [1000.0]
    2       (0000000a) div-long             v2, v10, v8
    3       (0000000e) rem-long             v4, v10, v8
    4       (00000012) div-long/2addr       v4, v6
    5       (00000014) add-long/2addr       v2, v4
    6       (00000016) rem-long             v4, v10, v6
    7       (0000001a) add-long/2addr       v2, v4
    8       (0000001c) div-long             v4, v12, v8
    9       (00000020) add-long/2addr       v2, v4
    10      (00000022) rem-long             v4, v12, v8
    11      (00000026) div-long/2addr       v4, v6
    12      (00000028) add-long/2addr       v2, v4
    13      (0000002a) rem-long             v4, v12, v6
    14      (0000002e) add-long/2addr       v2, v4
    15      (00000030) div-long             v4, v14, v8
    16      (00000034) add-long/2addr       v2, v4
    17      (00000036) rem-long             v4, v14, v8
    18      (0000003a) div-long/2addr       v4, v6
    19      (0000003c) add-long/2addr       v2, v4
    20      (0000003e) rem-long             v4, v14, v6
    21      (00000042) add-long             v0, v2, v4
    22      (00000046) const-wide/16        v2, 4096 # [4096.0]
    23      (0000004a) rem-long/2addr       v0, v2
    24      (0000004c) return-wide          v0

Is decompiled as:

    private static long calculateChecksum(long p10, long p12, long p14)
    {
        return ((((((((((p10 / 1000000.0) + ((p10 % 1000000.0) / 1000.0)) + (p10 % 1000.0)) + (p12 / 1000000.0)) + ((p12 % 1000000.0) / 1000.0)) + (p12 % 1000.0)) + (p14 / 1000000.0)) + ((p14 % 1000000.0) / 1000.0)) + (p14 % 1000.0)) * 4096.0);
    }

When it should be "% 4096".

Original issue reported on code.google.com by drspring...@gmail.com on 18 Jan 2013 at 3:39

GoogleCodeExporter commented 9 years ago

Original comment by anthony....@gmail.com on 18 Jan 2013 at 3:44

GoogleCodeExporter commented 9 years ago

Original comment by Lir...@gmail.com on 18 Jan 2013 at 8:33