From e382065b82e0a4858019c7ca4ce1c11227c7bd67 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Sat, 19 Apr 2014 00:33:12 +0000 Subject: [PATCH] ProfileData: Avoid UB when reading git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206674 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ProfileData/InstrProfReader.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/llvm/ProfileData/InstrProfReader.h b/include/llvm/ProfileData/InstrProfReader.h index 5b0c6257a63..18a7e43437a 100644 --- a/include/llvm/ProfileData/InstrProfReader.h +++ b/include/llvm/ProfileData/InstrProfReader.h @@ -222,8 +222,9 @@ public: static std::pair ReadKeyDataLength(const unsigned char *&D) { using namespace support; - return std::make_pair(endian::readNext(D), - endian::readNext(D)); + offset_type KeyLen = endian::readNext(D); + offset_type DataLen = endian::readNext(D); + return std::make_pair(KeyLen, DataLen); } StringRef ReadKey(const unsigned char *D, unsigned N) { -- 2.34.1