llvm-dwp: Add error handling for multiple type sections in a dwp file.

llvm-svn: 269851
This commit is contained in:
David Blaikie 2016-05-17 22:00:57 +00:00
parent dd3c6b42c5
commit 8bef4125f2
3 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,3 @@
RUN: not llvm-dwp %p/../Inputs/multiple_type_sections.dwp -o %t 2>&1 | FileCheck %s
CHECK: error: multiple type unit sections in .dwp file

View File

@ -537,7 +537,9 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
}
if (!CurTypesSection.empty()) {
assert(CurTypesSection.size() == 1);
if (CurTypesSection.size() != 1)
return make_error<DWPError>(
"multiple type unit sections in .dwp file");
DWARFUnitIndex TUIndex(DW_SECT_TYPES);
DataExtractor TUIndexData(CurTUIndexSection,
ErrOrObj->getBinary()->isLittleEndian(), 0);