This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Fix ubsan signed integer overflow
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 23 Jul 2015 12:52:18 +0930
- Subject: Fix ubsan signed integer overflow
- Authentication-results: sourceware.org; auth=none
IMO a fairly useless warning in this case, but technically correct.
PR 18708
* i386-dis.c (get64): Avoid signed integer overflow.
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 ();
--
Alan Modra
Australia Development Lab, IBM