[COFFDumper] Validate that the next offset is not too large

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271147 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2016-05-28 20:04:50 +00:00
parent 03348eaac6
commit 52b8c95368

View File

@ -736,6 +736,8 @@ void COFFDumper::printCodeViewSymbolSection(StringRef SectionName,
size_t SectionOffset = Data.data() - SectionContents.data();
size_t NextOffset = SectionOffset + SubSectionSize;
NextOffset = alignTo(NextOffset, 4);
if (NextOffset > SectionContents.size())
return error(object_error::parse_failed);
Data = SectionContents.drop_front(NextOffset);
// Optionally print the subsection bytes in case our parsing gets confused