[PATCH] D50006: [LLD] Fixed crash in type merging

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 13:02:46 PDT 2018


aganea created this revision.
aganea added a reviewer: zturner.
Herald added a subscriber: llvm-commits.

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 https://reviews.llvm.org/D45213)


Repository:
  rL LLVM

https://reviews.llvm.org/D50006

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


Index: llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
===================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
+++ llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
@@ -226,7 +226,10 @@
   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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50006.158053.patch
Type: text/x-patch
Size: 690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180730/20225cc2/attachment.bin>


More information about the llvm-commits mailing list