mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
ProfileData: Treat missing function counts as malformed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207172 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -101,6 +101,8 @@ error_code TextInstrProfReader::readNextRecord(InstrProfRecord &Record) {
|
||||
return error(instrprof_error::truncated);
|
||||
if ((Line++)->getAsInteger(10, NumCounters))
|
||||
return error(instrprof_error::malformed);
|
||||
if (NumCounters == 0)
|
||||
return error(instrprof_error::malformed);
|
||||
|
||||
// Read each counter and fill our internal storage with the values.
|
||||
Counts.clear();
|
||||
@@ -210,8 +212,10 @@ RawInstrProfReader<IntPtrT>::readNextRecord(InstrProfRecord &Record) {
|
||||
|
||||
// Get the raw data.
|
||||
StringRef RawName(getName(Data->NamePtr), swap(Data->NameSize));
|
||||
auto RawCounts = makeArrayRef(getCounter(Data->CounterPtr),
|
||||
swap(Data->NumCounters));
|
||||
uint32_t NumCounters = swap(Data->NumCounters);
|
||||
if (NumCounters == 0)
|
||||
return error(instrprof_error::malformed);
|
||||
auto RawCounts = makeArrayRef(getCounter(Data->CounterPtr), NumCounters);
|
||||
|
||||
// Check bounds.
|
||||
auto *NamesStartAsCounter = reinterpret_cast<const uint64_t *>(NamesStart);
|
||||
|
||||
Reference in New Issue
Block a user