1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Fix overflowing signed left shift, found by ubsan buildbot.

This commit is contained in:
Richard Smith 2021-02-03 12:51:11 -08:00
parent 65e46aa23b
commit d38c68eaec

View File

@ -176,7 +176,7 @@ inline int64_t decodeSLEB128(const uint8_t *p, unsigned *n = nullptr,
return 0;
}
Byte = *p;
int64_t Slice = Byte & 0x7f;
uint64_t Slice = Byte & 0x7f;
if ((Shift >= 64 && Slice != (Value < 0 ? 0x7f : 0x00)) ||
(Shift == 63 && Slice != 0 && Slice != 0x7f)) {
if (error)