1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

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

llvm-svn: 271147
This commit is contained in:
David Majnemer 2016-05-28 20:04:50 +00:00
parent 35bdb1faa1
commit ae2b1f0c97

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