Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit e382065

Browse files
committed
ProfileData: Avoid UB when reading
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206674 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 1907b94 commit e382065

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

include/llvm/ProfileData/InstrProfReader.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,9 @@ class InstrProfLookupTrait {
222222
static std::pair<offset_type, offset_type>
223223
ReadKeyDataLength(const unsigned char *&D) {
224224
using namespace support;
225-
return std::make_pair(endian::readNext<offset_type, little, unaligned>(D),
226-
endian::readNext<offset_type, little, unaligned>(D));
225+
offset_type KeyLen = endian::readNext<offset_type, little, unaligned>(D);
226+
offset_type DataLen = endian::readNext<offset_type, little, unaligned>(D);
227+
return std::make_pair(KeyLen, DataLen);
227228
}
228229

229230
StringRef ReadKey(const unsigned char *D, unsigned N) {

0 commit comments

Comments
 (0)