GithubHelp home page GithubHelp logo

Comments (10)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 20, 2024
0x1179: "CMPSS",
is also missing in distorm3.Mnemonics

Original comment by [email protected] on 24 Jan 2012 at 8:43

from distorm.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 20, 2024
The same happens for normal (without REX prefix) version:

>>> i = distorm3.Decompose(0x0000000001646b2e, "f30fc2ce06".decode('hex'), 
distorm3.Decode64Bits)[0]
>>> i.opcode
9: 4474
>>> i.mnemonic
10: 'UNDEFINED'
>>> i.valid
11: True


0x1179: "CMPSS",
is also missing in distorm3.Mnemonics

Original comment by [email protected] on 24 Jan 2012 at 8:50

from distorm.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 20, 2024
This issue and issue 30 seem to be caused by this line:
http://code.google.com/p/distorm/source/browse/trunk/src/decoder.c#296

                                di->opcode = ii->opcodeId + cmpType;

The index into the _MNEMONICS array is being offset by cmpType which has a 
value of 0-7 bytes. For the extended mnemonics of the cmpss/cmpsd/cmpps/cmppd 
instructions, we really want to offset by 0-7 mnemonics.

Original comment by [email protected] on 7 Feb 2012 at 5:28

from distorm.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 20, 2024
Here's a possible fix:

                int i;
                unsigned int stringOffset = 0;
                /*
                 * The _MNEMONICS string contains pascal-style strings with the length of each mnemonic specified.
                 * We will sum each mnemonic length to arrive at the final mnemonic offset.
                 */
                for (i=0; i<cmpType; i++) {
                     /* +1 is for the null terminator, +1 is for the length byte itself */
                    if (_MNEMONICS_SIZE <= (ii->opcodeId + stringOffset)) goto _Undecodable;
                    stringOffset += _MNEMONICS[ii->opcodeId + stringOffset] + 2;
                }
                if (_MNEMONICS_SIZE <= (ii->opcodeId + stringOffset)) goto _Undecodable;
               di->opcode = ii->opcodeId + stringOffset;


I added _MNEMONICS_SIZE to mnemonics.c for safety checking:
const unsigned int _MNEMONICS_SIZE = sizeof(_MNEMONICS);

Original comment by [email protected] on 7 Feb 2012 at 5:31

from distorm.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 20, 2024
Issue 30 has been merged into this issue.

Original comment by [email protected] on 26 Feb 2012 at 11:38

from distorm.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 20, 2024

Original comment by [email protected] on 26 Feb 2012 at 11:38

  • Changed state: Accepted

from distorm.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 20, 2024

Original comment by [email protected] on 26 Feb 2012 at 3:55

  • Added labels: Priority-High
  • Removed labels: Priority-Medium

from distorm.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 20, 2024
Sanjay, thanks for your patch suggestion, but I used another way that doesn't 
need to loop - just another static table to look up the offsets.

Original comment by [email protected] on 27 Feb 2012 at 5:37

  • Changed state: Fixed

from distorm.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 20, 2024
This issue was closed by revision r195.

Original comment by [email protected] on 27 Feb 2012 at 6:05

from distorm.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 20, 2024
This issue was closed by revision r197.

Original comment by [email protected] on 28 Feb 2012 at 2:53

from distorm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.