This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix a segmentation fault triggered by disassembling an EFi file with source included.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=219d6836e939d2cd1a8c5574bfa3a101daa31cbb

commit 219d6836e939d2cd1a8c5574bfa3a101daa31cbb
Author: Nick Clifton <nickc@redhat.com>
Date:   Wed Mar 6 09:43:15 2019 +0000

    Fix a segmentation fault triggered by disassembling an EFi file with source included.
    
    	* 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

Diff:
---
 bfd/ChangeLog | 7 +++++++
 bfd/coffgen.c | 5 +++--
 bfd/dwarf2.c  | 2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 73de8b8..15a5a99 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 309e124..5f5c5f6 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -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;
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 0b4e485..56557bb 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]