From 2be59141b8512fd0aefacdcbd687eef85d96c86d Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sat, 28 May 2016 05:59:22 +0000 Subject: [PATCH] An empty record cannot be null-terminated git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271104 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/DebugInfo/CodeView/RecordSerialization.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/llvm/DebugInfo/CodeView/RecordSerialization.h b/include/llvm/DebugInfo/CodeView/RecordSerialization.h index ef44f9d9418..84179f5f81f 100644 --- a/include/llvm/DebugInfo/CodeView/RecordSerialization.h +++ b/include/llvm/DebugInfo/CodeView/RecordSerialization.h @@ -140,6 +140,9 @@ struct serialize_null_term_string_array_impl { : Item(Item) {} std::error_code deserialize(ArrayRef &Data) const { + if (Data.empty()) + return std::make_error_code(std::errc::illegal_byte_sequence); + StringRef Field; // Stop when we run out of bytes or we hit record padding bytes. while (Data.front() != 0) { -- 2.11.0