]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix two invalid signed left shifts picked up by ubsan.
authorJulian Seward <jseward@acm.org>
Fri, 5 Aug 2016 10:34:15 +0000 (10:34 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 5 Aug 2016 10:34:15 +0000 (10:34 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@3238

VEX/priv/guest_arm64_toIR.c

index ca53d9dc1208bda8baed5f87ee79fd85c4166376..e5274474dcd9414bc579e0be91882c7f83743148 100644 (file)
@@ -148,8 +148,9 @@ static inline UInt getUIntLittleEndianly ( const UChar* p )
 static ULong sx_to_64 ( ULong x, UInt n )
 {
    vassert(n > 1 && n < 64);
+   x <<= (64-n);
    Long r = (Long)x;
-   r = (r << (64-n)) >> (64-n);
+   r >>= (64-n);
    return (ULong)r;
 }
 
@@ -2590,7 +2591,7 @@ Bool dis_ARM64_data_processing_immediate(/*MB_OUT*/DisResult* dres,
                   IRTemp old = newTemp(Ity_I32);
                   assign(old, getIReg32orZR(dd));
                   vassert(hw <= 1);
-                  UInt mask = 0xFFFF << (16 * hw);
+                  UInt mask = ((UInt)0xFFFF) << (16 * hw);
                   IRExpr* res
                      = binop(Iop_Or32, 
                              binop(Iop_And32, mkexpr(old), mkU32(~mask)),