Code Monkey home page Code Monkey logo

Comments (2)

BenBE avatar BenBE commented on September 28, 2024

A possible patch like this untested one below should work:

diff --git a/libudis86/decode.c b/libudis86/decode.c
index a7a4896..b625c47 100644
--- a/libudis86/decode.c
+++ b/libudis86/decode.c
@@ -622,6 +622,7 @@ decode_operand(struct ud           *u,
                unsigned int         size)
 {
   operand->_oprcode = type;
+  operand->opoffset = u->inp_ctr;

   switch (type) {
     case OP_A :
diff --git a/libudis86/types.h b/libudis86/types.h
index bdfd4d9..7e32b2e 100644
--- a/libudis86/types.h
+++ b/libudis86/types.h
@@ -154,6 +154,7 @@ struct ud_operand {
   uint8_t         offset;
   union ud_lval   lval;
   uint64_t        disp;
+  uint16_t        opoffset;
   /*
    * internal use only
    */

from udis86.

BenBE avatar BenBE commented on September 28, 2024

There is another assignment of the current offset required after decoding the possibly optional Mod/RM byte of the instruction, before reading its actual operand value.

Example: 89 57 2a -> should result in OP1 at opoffset 2, not 1 as returned by the initial patch suggestion.

from udis86.

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.