[llvm] r271171 - [CVRecord] Don't assume that the record has two bytes of data in it
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Sat May 28 23:18:05 PDT 2016
Author: majnemer
Date: Sun May 29 01:18:04 2016
New Revision: 271171
URL: http://llvm.org/viewvc/llvm-project?rev=271171&view=rev
Log:
[CVRecord] Don't assume that the record has two bytes of data in it
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/CVRecord.h
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/CVRecord.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CVRecord.h?rev=271171&r1=271170&r2=271171&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/CVRecord.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/CVRecord.h Sun May 29 01:18:04 2016
@@ -34,6 +34,8 @@ template <typename Kind> struct VarStrea
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;
More information about the llvm-commits
mailing list