diff --git a/lib/DebugInfo/PDB/Raw/PublicsStream.cpp b/lib/DebugInfo/PDB/Raw/PublicsStream.cpp index 9a2b142ccfb..d7e3b60f1ab 100644 --- a/lib/DebugInfo/PDB/Raw/PublicsStream.cpp +++ b/lib/DebugInfo/PDB/Raw/PublicsStream.cpp @@ -138,10 +138,14 @@ Error PublicsStream::reload() { // corrupted streams. // Hash buckets follow. - HashBuckets.resize(NumBuckets); - if (auto EC = Reader.readArray(HashBuckets)) + std::vector TempHashBuckets; + TempHashBuckets.resize(NumBuckets); + if (auto EC = Reader.readArray(TempHashBuckets)) return make_error(raw_error_code::corrupt_file, "Hash buckets corrupted."); + HashBuckets.resize(NumBuckets); + std::copy(TempHashBuckets.begin(), TempHashBuckets.end(), + HashBuckets.begin()); // Something called "address map" follows. AddressMap.resize(Header->AddrMap / sizeof(uint32_t));