summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornaddy <naddy@openbsd.org>2017-06-04 20:26:18 +0000
committernaddy <naddy@openbsd.org>2017-06-04 20:26:18 +0000
commitda3ef51629fc524b532ee6a16c72d61207413dc9 (patch)
treefc2db8910845a2e7b7143dbe766e7bf4f88aa2af
parentUpdate to perl File::Path 2.13 for security fixes (diff)
downloadwireguard-openbsd-da3ef51629fc524b532ee6a16c72d61207413dc9.tar.xz
wireguard-openbsd-da3ef51629fc524b532ee6a16c72d61207413dc9.zip
Replace ((2 << 31) - 1) with 0xffffffff, which is equivalent but doesn't
cause a shift overflow on a 32-bit arch (i386). ok kettenis@
-rw-r--r--gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c b/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c
index 1bfd4670813..5447323e1ce 100644
--- a/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c
+++ b/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c
@@ -2104,7 +2104,7 @@ optimize_imm ()
(((i.op[op].imms->X_add_number & 0xffff) ^ 0x8000) - 0x8000);
}
if ((i.types[op] & Imm32)
- && ((i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1))
+ && ((i.op[op].imms->X_add_number & ~(offsetT) 0xffffffffL)
== 0))
{
i.op[op].imms->X_add_number = ((i.op[op].imms->X_add_number
@@ -2183,12 +2183,12 @@ optimize_disp ()
i.types[op] &= ~Disp64;
}
if ((i.types[op] & Disp32)
- && (disp & ~(((offsetT) 2 << 31) - 1)) == 0)
+ && (disp & ~(offsetT) 0xffffffffL) == 0)
{
/* If this operand is at most 32 bits, convert
to a signed 32 bit number and don't use 64bit
displacement. */
- disp &= (((offsetT) 2 << 31) - 1);
+ disp &= (offsetT) 0xffffffffL;
disp = (disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31);
i.types[op] &= ~Disp64;
}