This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fix ubsan signed integer overflow
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 23 Jul 2015 03:23:40 -0000
- Subject: [binutils-gdb] Fix ubsan signed integer overflow
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=070fe95d07c78349f0c8f0fa90aeb92d05248483
commit 070fe95d07c78349f0c8f0fa90aeb92d05248483
Author: Alan Modra <amodra@gmail.com>
Date: Thu Jul 23 12:41:38 2015 +0930
Fix ubsan signed integer overflow
IMO a fairly useless warning in this case, but technically correct.
PR 18708
* i386-dis.c (get64): Avoid signed integer overflow.
Diff:
---
opcodes/ChangeLog | 7 ++++++-
opcodes/i386-dis.c | 4 ++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 6ba1b85..f1ec2b0 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-23 Alan Modra <amodra@gmail.com>
+
+ PR 18708
+ * i386-dis.c (get64): Avoid signed integer overflow.
+
2015-07-22 Alexander Fomin <alexander.fomin@intel.com>
PR binutils/18631
@@ -82,7 +87,7 @@
2015-06-19 Peter Bergner <bergner@vnet.ibm.com>
- * ppc-dis.h (skip_optional_operands): Use ppc_optional_operand_value.
+ * ppc-dis.h (skip_optional_operands): Use ppc_optional_operand_value.
* ppc-opc.c (FXM4): Add non-zero optional value.
(TBR): Likewise.
(SXL): Likewise.
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index e768029..a279b56 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -15387,11 +15387,11 @@ get64 (void)
a = *codep++ & 0xff;
a |= (*codep++ & 0xff) << 8;
a |= (*codep++ & 0xff) << 16;
- a |= (*codep++ & 0xff) << 24;
+ a |= (*codep++ & 0xffu) << 24;
b = *codep++ & 0xff;
b |= (*codep++ & 0xff) << 8;
b |= (*codep++ & 0xff) << 16;
- b |= (*codep++ & 0xff) << 24;
+ b |= (*codep++ & 0xffu) << 24;
x = a + ((bfd_vma) b << 32);
#else
abort ();