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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269851 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2016-05-17 22:00:57 +00:00
parent d640f9183d
commit 7fdce00ff3
3 changed files with 6 additions and 1 deletions

Binary file not shown.

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);