[CVRecord] Don't assume that the record has two bytes of data in it

llvm-svn: 271171
This commit is contained in:
David Majnemer 2016-05-29 06:18:04 +00:00
parent 2fa58d5a19
commit a1f3014900

View File

@ -34,6 +34,8 @@ template <typename Kind> struct VarStreamArrayExtractor<CVRecord<Kind>> {
if (auto EC = Reader.readObject(Prefix))
return EC;
Item.Length = Prefix->RecordLen;
if (Item.Length < 2)
return make_error<CodeViewError>(cv_error_code::corrupt_record);
Item.Type = static_cast<Kind>(uint16_t(Prefix->RecordKind));
if (auto EC = Reader.readBytes(Item.Data, Item.Length - 2))
return EC;