[COFFDumper] Make sure there is sufficient padding left in the string table

llvm-svn: 271146
This commit is contained in:
David Majnemer 2016-05-28 20:04:48 +00:00
parent c6cb2ec36e
commit efaaf410a6
1 changed files with 4 additions and 1 deletions

View File

@ -687,7 +687,10 @@ void COFFDumper::initializeFileAndStringTables(StringRef Data) {
default:
break;
}
Data = Data.drop_front(alignTo(SubSectionSize, 4));
uint32_t PaddedSize = alignTo(SubSectionSize, 4);
if (PaddedSize > Data.size())
error(object_error::parse_failed);
Data = Data.drop_front(PaddedSize);
}
}