Skip to content

Commit c30a699

Browse files
return truncated error if any
1 parent 67bbafb commit c30a699

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/ProfileData/InstrProfReader.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,11 @@ Error IndexedInstrProfReader::readHeader() {
12931293
support::endian::readNext<uint64_t, llvm::endianness::little,
12941294
unaligned>(Ptr);
12951295

1296+
// Writer first writes the length of compressed string, and then the actual
1297+
// content.
12961298
VTableNamePtr = (const char *)Ptr;
1299+
if (VTableNamePtr > (const char *)DataBuffer->getBufferEnd())
1300+
return make_error<InstrProfError>(instrprof_error::truncated);
12971301
}
12981302

12991303
if (GET_VERSION(Header->formatVersion()) >= 10 &&

0 commit comments

Comments
 (0)