[llvm] r364461 - Fix some undefined behavior (excessive shift of signed value) in r364253 detected by ubsan
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 26 12:18:50 PDT 2019
Author: dblaikie
Date: Wed Jun 26 12:18:50 2019
New Revision: 364461
URL: http://llvm.org/viewvc/llvm-project?rev=364461&view=rev
Log:
Fix some undefined behavior (excessive shift of signed value) in r364253 detected by ubsan
Modified:
llvm/trunk/include/llvm/Support/LEB128.h
Modified: llvm/trunk/include/llvm/Support/LEB128.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/LEB128.h?rev=364461&r1=364460&r2=364461&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/LEB128.h (original)
+++ llvm/trunk/include/llvm/Support/LEB128.h Wed Jun 26 12:18:50 2019
@@ -176,7 +176,7 @@ inline int64_t decodeSLEB128(const uint8
return 0;
}
Byte = *p++;
- Value |= (int64_t(Byte & 0x7f) << Shift);
+ Value |= (uint64_t(Byte & 0x7f) << Shift);
Shift += 7;
} while (Byte >= 128);
// Sign extend negative numbers if needed.
More information about the llvm-commits
mailing list