seoyoonm / androguard

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

Bugs in dvm.py #92

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Some bugs in dvm.py.

1. Unpack creates negative indexes in const-string(/jumbo) instructions. 

class Instruction21c(Instruction) :
    def __init__(self, cm, buff) :
...
      self.BBBB = unpack("=h", buff[2:4])[0]
                         ^^^^^
Must be 'H'.
The same is for Instruction31c

2. Instruction31c doesn't have method 'get_raw_string' which is used by 
decompiler. Something like:

    def get_raw_string(self) :
      return get_kind(self.cm, KIND_RAW_STRING, self.BBBBBBBB)

Original issue reported on code.google.com by neepo...@gmail.com on 13 Dec 2012 at 5:23

GoogleCodeExporter commented 9 years ago
Can you push a sample please ?

Original comment by anthony....@gmail.com on 13 Dec 2012 at 5:27

GoogleCodeExporter commented 9 years ago
I think any big .dex will be fine. E.g. framework from emulator.

Original comment by neepo...@gmail.com on 13 Dec 2012 at 6:15

Attachments:

GoogleCodeExporter commented 9 years ago
Could you try with my last commit ?

Thx

Original comment by anthony....@gmail.com on 13 Dec 2012 at 6:59

GoogleCodeExporter commented 9 years ago
4495    +         return pack("=HH", (self.AA << 8) | self.OP, self.BBBBBBBB)
                                          ^^^^
there is a mistake. must be =HI.
In other terms I think all is fine because I patched the same places.

P.S. Thank you for creating such nice reversing framework.

Original comment by neepo...@gmail.com on 13 Dec 2012 at 8:45

GoogleCodeExporter commented 9 years ago
Oops thx !

Fixed

Original comment by anthony....@gmail.com on 14 Dec 2012 at 7:24