From: Alexandre Ganea Date: Mon, 30 Jul 2018 21:14:25 +0000 (+0000) Subject: This fixes a crash when a second pass is required for the Codeview Type merging ... X-Git-Tag: llvmorg-7.0.0-rc1~251 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0bb8e8918795ba0d403fd89982afd9dba128979b;p=platform%2Fupstream%2Fllvm.git 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 llvm-svn: 338308 --- diff --git a/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp b/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp index e4f39dd..2e29c9d 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp @@ -226,7 +226,10 @@ bool TypeStreamMerger::remapIndexFallback(TypeIndex &Idx, 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;