[llvm] r338308 - This fixes a crash when a second pass is required for the Codeview Type merging *and* the index points outside of the table (which should lead to an error being printed).

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 14:14:25 PDT 2018


Author: aganea
Date: Mon Jul 30 14:14:25 2018
New Revision: 338308

URL: http://llvm.org/viewvc/llvm-project?rev=338308&view=rev
Log:
This fixes a crash when a second pass is required for the Codeview Type merging *and* the index points outside of the table (which should lead to an error being printed).

This occurs currently until MS precompiled headers .obj is added (see D45213)

Differential Revision: https://reviews.llvm.org/D50006

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

Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp?rev=338308&r1=338307&r2=338308&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp Mon Jul 30 14:14:25 2018
@@ -226,7 +226,10 @@ bool TypeStreamMerger::remapIndexFallbac
   if (IsSecondPass && MapPos >= Map.size()) {
     // FIXME: Print a more useful error. We can give the current record and the
     // index that we think its pointing to.
-    LastError = joinErrors(std::move(*LastError), errorCorruptRecord());
+    if (LastError)
+      LastError = joinErrors(std::move(*LastError), errorCorruptRecord());
+    else
+      LastError = errorCorruptRecord();
   }
 
   ++NumBadIndices;




More information about the llvm-commits mailing list