summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2019-06-26 19:18:50 +0000
committerDavid Blaikie <dblaikie@gmail.com>2019-06-26 19:18:50 +0000
commit730a95c88aff8ceb7bd88cd4d8f30f533896cfb2 (patch)
tree9de5ed58c5f2ea2a05d30e3d834022158186c133
parent806600987d39a4c47faa9dc993f7c5564bc17b13 (diff)
downloadbcm5719-llvm-730a95c88aff8ceb7bd88cd4d8f30f533896cfb2.tar.gz
bcm5719-llvm-730a95c88aff8ceb7bd88cd4d8f30f533896cfb2.zip
Fix some undefined behavior (excessive shift of signed value) in r364253 detected by ubsan
llvm-svn: 364461
-rw-r--r--llvm/include/llvm/Support/LEB128.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/include/llvm/Support/LEB128.h b/llvm/include/llvm/Support/LEB128.h
index 0f83723b8b9..a02b83ca959 100644
--- a/llvm/include/llvm/Support/LEB128.h
+++ b/llvm/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.
OpenPOWER on IntegriCloud