[llvm] r271104 - An empty record cannot be null-terminated
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Fri May 27 22:59:22 PDT 2016
Author: majnemer
Date: Sat May 28 00:59:22 2016
New Revision: 271104
URL: http://llvm.org/viewvc/llvm-project?rev=271104&view=rev
Log:
An empty record cannot be null-terminated
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/RecordSerialization.h
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/RecordSerialization.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/RecordSerialization.h?rev=271104&r1=271103&r2=271104&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/RecordSerialization.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/RecordSerialization.h Sat May 28 00:59:22 2016
@@ -140,6 +140,9 @@ struct serialize_null_term_string_array_
: Item(Item) {}
std::error_code deserialize(ArrayRef<uint8_t> &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) {
More information about the llvm-commits
mailing list