Skip to content

Commit

Permalink
fix offset width when disassembling far pointers in 16/32b mode
Browse files Browse the repository at this point in the history
   * using eosz instead of just the 64b mode indicator

   * ~16 year old bug...

   * #233

(cherry picked from commit 932bbd537986d804ec96e5ae18f56589fe61555a)
  • Loading branch information
mjcharne committed Aug 20, 2020
1 parent a25d4a7 commit ce30eac
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/dec/xed-disas.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,10 +962,8 @@ static void xed_print_operand( xed_print_info_t* pi )
unsigned int disp =(unsigned int)
xed_operand_values_get_branch_displacement_int32(ov);

xed_bool_t long_mode = xed_operand_values_get_long_mode(
xed_decoded_inst_operands_const(pi->p));

xed_uint_t bits_to_print = long_mode ? 8*8 :4*8;
xed_uint_t bits_to_print = xed_operand_values_get_effective_operand_width(ov);

if (pi->format_options.xml_a)
xed_pi_strcat(pi,"<PTR>");

Expand Down Expand Up @@ -1420,11 +1418,8 @@ xed_decoded_inst_dump_att_format_internal(
case XED_OPERAND_PTR: {
unsigned int disp =
xed_decoded_inst_get_branch_displacement(pi->p);
xed_bool_t long_mode =
xed_operand_values_get_long_mode(
xed_decoded_inst_operands_const(pi->p));
xed_uint_t bits_to_print = xed_operand_values_get_effective_operand_width(ov);

xed_uint_t bits_to_print = long_mode ? 8*8 :4*8;
xed_pi_strcat(pi,"$0x");
pi->blen = xed_itoa_hex_ul(pi->buf+xed_strlen(pi->buf),
disp,
Expand Down

0 comments on commit ce30eac

Please sign in to comment.