[PATCH] D39336: [dsymutil] Check AttrInfo.Name validity before using it

Keno Fischer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 09:54:39 PDT 2017


loladiro created this revision.
Herald added a subscriber: JDevlieghere.

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


https://reviews.llvm.org/D39336

Files:
  tools/dsymutil/DwarfLinker.cpp


Index: tools/dsymutil/DwarfLinker.cpp
===================================================================
--- tools/dsymutil/DwarfLinker.cpp
+++ tools/dsymutil/DwarfLinker.cpp
@@ -2878,7 +2878,8 @@
                               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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39336.120442.patch
Type: text/x-patch
Size: 623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171026/4385857f/attachment.bin>


More information about the llvm-commits mailing list