summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-06-20 02:05:35 +0000
committerVedant Kumar <vsk@apple.com>2017-06-20 02:05:35 +0000
commitb1d331a36e908a8f4b22347b2ad7215eca640e85 (patch)
tree0cfd77e599b42779c1fa13fbfa323f771304f966 /llvm/lib/ProfileData
parent9c0395e39e1ec90cf040f0428260f0ef363c50f8 (diff)
downloadbcm5719-llvm-b1d331a36e908a8f4b22347b2ad7215eca640e85.tar.gz
bcm5719-llvm-b1d331a36e908a8f4b22347b2ad7215eca640e85.zip
[Coverage] PR33517: Check for failure to load func records
With PR33517, it became apparent that symbol table creation can fail when presented with malformed inputs. This patch makes that sort of error detectable, so llvm-cov etc. can fail more gracefully. Specifically, we now check that function records loaded from corrupted coverage mapping data are rejected, e.g when the recorded function name is garbage. Testing: check-{llvm,clang,profile}, some unit test updates. llvm-svn: 305767
Diffstat (limited to 'llvm/lib/ProfileData')
-rw-r--r--llvm/lib/ProfileData/Coverage/CoverageMapping.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index 015b3c6c202..953972968d6 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -200,6 +200,9 @@ Error CoverageMapping::loadFunctionRecord(
const CoverageMappingRecord &Record,
IndexedInstrProfReader &ProfileReader) {
StringRef OrigFuncName = Record.FunctionName;
+ if (OrigFuncName.empty())
+ return make_error<CoverageMapError>(coveragemap_error::malformed);
+
if (Record.Filenames.empty())
OrigFuncName = getFuncNameWithoutPrefix(OrigFuncName);
else
OpenPOWER on IntegriCloud