From 6a4aee34a905d491ea67e1a368a725f8617ca61a Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Wed, 26 Jun 2019 19:18:50 +0000 Subject: [PATCH] Fix some undefined behavior (excessive shift of signed value) in r364253 detected by ubsan git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364461 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/LEB128.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/llvm/Support/LEB128.h b/include/llvm/Support/LEB128.h index 0f83723b8b9..a02b83ca959 100644 --- a/include/llvm/Support/LEB128.h +++ b/include/llvm/Support/LEB128.h @@ -176,7 +176,7 @@ inline int64_t decodeSLEB128(const uint8_t *p, unsigned *n = nullptr, 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. -- 2.11.0