ProfileData: Avoid UB when reading

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206674 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Bogner 2014-04-19 00:33:12 +00:00
parent 1907b94222
commit e382065b82

View File

@ -222,8 +222,9 @@ public:
static std::pair<offset_type, offset_type>
ReadKeyDataLength(const unsigned char *&D) {
using namespace support;
return std::make_pair(endian::readNext<offset_type, little, unaligned>(D),
endian::readNext<offset_type, little, unaligned>(D));
offset_type KeyLen = endian::readNext<offset_type, little, unaligned>(D);
offset_type DataLen = endian::readNext<offset_type, little, unaligned>(D);
return std::make_pair(KeyLen, DataLen);
}
StringRef ReadKey(const unsigned char *D, unsigned N) {