From ea6f05e017653ff7851ffb1e263847cc9e6d7cec Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Thu, 26 Oct 2017 17:31:33 +0000 Subject: [PATCH] [dsymutil] Check AttrInfo.Name validity before using it MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Summary: This upstreams a patch from the osxcross [1] toolchain. It appears that llvm-dsymutil crashes at this place during GCC bootstrap. Adding the check here seems reasonable, since it operates on arbitrary input DWARF, not necessarily generated by the LLVM toolchain, and it seems the un-mangled name need not necessarily exist. Patch by Thomas Pöchtrager [1] https://github.com/tpoechtrager/osxcross Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D39336 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316678 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/dsymutil/DwarfLinker.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/dsymutil/DwarfLinker.cpp b/tools/dsymutil/DwarfLinker.cpp index e422bd035cb..b22b7a9dd1a 100644 --- a/tools/dsymutil/DwarfLinker.cpp +++ b/tools/dsymutil/DwarfLinker.cpp @@ -2878,7 +2878,8 @@ DIE *DwarfLinker::DIECloner::cloneDIE( Tag == dwarf::DW_TAG_inlined_subroutine); } else if (isTypeTag(Tag) && !AttrInfo.IsDeclaration && getDIENames(InputDIE, AttrInfo)) { - Unit.addTypeAccelerator(Die, AttrInfo.Name, AttrInfo.NameOffset); + if (AttrInfo.Name) + Unit.addTypeAccelerator(Die, AttrInfo.Name, AttrInfo.NameOffset); } // Determine whether there are any children that we want to keep. -- 2.40.0