1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[Support] Fix overflow in SLEB128 decoding.

decodeULEB128 was fixed in r216268, but decodeSLEB128 always had the
same issue, which is now exposed in r301369.

llvm-svn: 301510
This commit is contained in:
Ahmed Bougacha 2017-04-27 02:09:44 +00:00
parent 60b774306e
commit c840b5c6e8

View File

@ -160,7 +160,7 @@ inline int64_t decodeSLEB128(const uint8_t *p, unsigned *n = nullptr,
return 0;
}
Byte = *p++;
Value |= ((Byte & 0x7f) << Shift);
Value |= (int64_t(Byte & 0x7f) << Shift);
Shift += 7;
} while (Byte >= 128);
// Sign extend negative numbers.