diff options
author | Vedant Kumar <vsk@apple.com> | 2017-06-20 02:05:35 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2017-06-20 02:05:35 +0000 |
commit | b1d331a36e908a8f4b22347b2ad7215eca640e85 (patch) | |
tree | 0cfd77e599b42779c1fa13fbfa323f771304f966 /llvm/lib/ProfileData | |
parent | 9c0395e39e1ec90cf040f0428260f0ef363c50f8 (diff) | |
download | bcm5719-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.cpp | 3 |
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 |