This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb/binutils-2_26-branch] Add parentheses to prevent truncated addresses
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 16 Feb 2016 00:05:07 -0000
- Subject: [binutils-gdb/binutils-2_26-branch] Add parentheses to prevent truncated addresses
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6b72c95a77f477c0048fddc8f1f602667632cab2
commit 6b72c95a77f477c0048fddc8f1f602667632cab2
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Feb 15 15:58:42 2016 -0800
Add parentheses to prevent truncated addresses
Backport from master
* i386-dis.c (print_insn): Parenthesize expression to prevent
truncated addresses.
(OP_J): Likewise.
Diff:
---
opcodes/ChangeLog | 9 +++++++++
opcodes/i386-dis.c | 4 ++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index e485a36..7e20a8f 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,12 @@
+2016-02-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from master
+ 2016-02-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * i386-dis.c (print_insn): Parenthesize expression to prevent
+ truncated addresses.
+ (OP_J): Likewise.
+
2016-01-25 Tristan Gingold <gingold@adacore.com>
* configure: Regenerate.
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 1b4c51a..3712b59 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -13644,7 +13644,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
if (op_index[i] != -1 && op_riprel[i])
{
(*info->fprintf_func) (info->stream, " # ");
- (*info->print_address_func) ((bfd_vma) (start_pc + codep - start_codep
+ (*info->print_address_func) ((bfd_vma) (start_pc + (codep - start_codep)
+ op_address[op_index[i]]), info);
break;
}
@@ -16158,7 +16158,7 @@ OP_J (int bytemode, int sizeflag)
the displacement is added! */
mask = 0xffff;
if ((prefixes & PREFIX_DATA) == 0)
- segment = ((start_pc + codep - start_codep)
+ segment = ((start_pc + (codep - start_codep))
& ~((bfd_vma) 0xffff));
}
if (address_mode != mode_64bit