[llvm] r303408 - Don't crash if someone tries to visit an empty type stream.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 22:18:09 PDT 2017


Author: zturner
Date: Fri May 19 00:18:09 2017
New Revision: 303408

URL: http://llvm.org/viewvc/llvm-project?rev=303408&view=rev
Log:
Don't crash if someone tries to visit an empty type stream.

Modified:
    llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp

Modified: llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp?rev=303408&r1=303407&r2=303408&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp Fri May 19 00:18:09 2017
@@ -227,6 +227,9 @@ Error CVTypeVisitor::visitTypeStream(CVT
 }
 
 Error CVTypeVisitor::visitTypeStream(TypeCollection &Types) {
+  if (Types.empty())
+    return Error::success();
+
   Optional<TypeIndex> I = Types.getFirst();
   do {
     CVType Type = Types.getType(*I);




More information about the llvm-commits mailing list