[PATCH] D61889: [ELF] --gdb-index: fix SIGSEGV when a DWARFAddressRange has invalid SectionIndex

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 05:52:07 PDT 2019


MaskRay created this revision.
Herald added subscribers: llvm-commits, arphaman, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D61889

Files:
  ELF/SyntheticSections.cpp


Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ ELF/SyntheticSections.cpp
@@ -2367,6 +2367,8 @@
 
     ArrayRef<InputSectionBase *> Sections = Sec->File->getSections();
     for (DWARFAddressRange &R : *Ranges) {
+      if (R.SectionIndex == -1ULL)
+        continue;
       InputSectionBase *S = Sections[R.SectionIndex];
       if (!S || S == &InputSection::Discarded || !S->Live)
         continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61889.199415.patch
Type: text/x-patch
Size: 489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190514/789184f5/attachment.bin>


More information about the llvm-commits mailing list