Fix a segmentation fault triggered by disassembling an EFi file with source included.
authorNick Clifton <nickc@redhat.com>
Wed, 6 Mar 2019 09:43:15 +0000 (09:43 +0000)
committerNick Clifton <nickc@redhat.com>
Wed, 6 Mar 2019 09:43:54 +0000 (09:43 +0000)
* dwarf2.c (_bfd_dwarf2_find_symbol_bias): Check for a NULL symbol
table pointer.
* coffgen.c (coff_find_nearest_line_with_names): Do not call
_bfd_dwarf2_find_symbol_bias if there is no symbol table available.

https://bugzilla.redhat.com/show_bug.cgi?id=1685727

bfd/ChangeLog
bfd/coffgen.c
bfd/dwarf2.c

index 73de8b8d5f8202bf94204acae7822e415448e4d8..15a5a999e103d1028feda28521ee7fd7cb7eba5b 100644 (file)
@@ -1,3 +1,10 @@
+2019-03-06  Nick Clifton  <nickc@redhat.com>
+
+       * dwarf2.c (_bfd_dwarf2_find_symbol_bias): Check for a NULL symbol
+       table pointer.
+       * coffgen.c (coff_find_nearest_line_with_names): Do not call
+       _bfd_dwarf2_find_symbol_bias if there is no symbol table available.
+
 2019-03-01  Andreas Krebbel  <krebbel@linux.ibm.com>
 
        This reverts commit 5a12586d44fa8d5dfc74cbca4f2f36a273a16335.
index 309e1249ac8a4f598c2eebe1dbb207fe0873876b..5f5c5f67a455549ffd26da535aac19f4e394e497 100644 (file)
@@ -2294,7 +2294,7 @@ coff_find_nearest_line_with_names (bfd *abfd,
      information.  So try again, using a bias against the address sought.  */
   if (coff_data (abfd)->dwarf2_find_line_info != NULL)
     {
-      bfd_signed_vma bias;
+      bfd_signed_vma bias = 0;
 
       /* Create a cache of the result for the next call.  */
       if (sec_data == NULL && section->owner == abfd)
@@ -2306,10 +2306,11 @@ coff_find_nearest_line_with_names (bfd *abfd,
 
       if (sec_data != NULL && sec_data->saved_bias)
        bias = sec_data->saved_bias;
-      else
+      else if (symbols)
        {
          bias = _bfd_dwarf2_find_symbol_bias (symbols,
                                               & coff_data (abfd)->dwarf2_find_line_info);
+
          if (sec_data)
            {
              sec_data->saved_bias = TRUE;
index 0b4e4855821d75231d62ed80fa5dc68abb310511..56557bbc81f84d301a2225c2bd4f49ed19d386a6 100644 (file)
@@ -4472,7 +4472,7 @@ _bfd_dwarf2_find_symbol_bias (asymbol ** symbols, void ** pinfo)
 
   stash = (struct dwarf2_debug *) *pinfo;
 
-  if (stash == NULL)
+  if (stash == NULL || symbols == NULL)
     return 0;
 
   for (unit = stash->all_comp_units; unit; unit = unit->next_unit)