summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-04-19 00:33:12 +0000
committerJustin Bogner <mail@justinbogner.com>2014-04-19 00:33:12 +0000
commite382065b82e0a4858019c7ca4ce1c11227c7bd67 (patch)
tree50c1c26f22ec89dcbc76480bb413a7daac83707c /include
parent1907b942222c3fc7a11cffd51990ca7693bb9254 (diff)
downloadllvm-e382065b82e0a4858019c7ca4ce1c11227c7bd67.tar.gz
llvm-e382065b82e0a4858019c7ca4ce1c11227c7bd67.tar.bz2
llvm-e382065b82e0a4858019c7ca4ce1c11227c7bd67.tar.xz
ProfileData: Avoid UB when reading
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206674 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ProfileData/InstrProfReader.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/llvm/ProfileData/InstrProfReader.h b/include/llvm/ProfileData/InstrProfReader.h
index 5b0c6257a6..18a7e43437 100644
--- a/include/llvm/ProfileData/InstrProfReader.h
+++ b/include/llvm/ProfileData/InstrProfReader.h
@@ -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) {