public inbox for bfd@sourceware.org
 help / color / mirror / Atom feed
* [gas-980322]: Bugs in IEEE handling - patch included
@ 1998-03-23  4:56 Manfred Hollstein
  0 siblings, 0 replies; only message in thread
From: Manfred Hollstein @ 1998-03-23  4:56 UTC (permalink / raw)
  To: bfd, gas2

I often found GNU nm and objdump core dumping when applied on an MRI
supplied objects and library files. Since we need to write some support
scripts around the MRI toolchain here, I debugged this today.

The problem is caused by dereferencing various pointers without prior
looking at their current values. I've fixed the ones, which I've seen
by running nm-new and objdump on several MRI files. I'm pretty sure,
there are other locations in this file which need to be fixed.

Mon Mar 23 13:10:21 1998  Manfred Hollstein  <manfred@s-direktnet.de>

	* ieee.c (do_one): Check section before dereferencing it.
	(ieee_canonicalize_reloc): Likewise with src->relent.sym_ptr_ptr.
	(ieee_generic_stat_arch_elt): Likewise with abfd->my_archive.

diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el gas-980322.orig/bfd/ieee.c gas-980322/bfd/ieee.c
--- gas-980322.orig/bfd/ieee.c	Sun Mar 22 10:12:51 1998
+++ gas-980322/bfd/ieee.c	Mon Mar 23 13:35:55 1998
@@ -1646,7 +1646,7 @@ do_one (ieee, current_map, location_ptr,
 		  s->flags |= SEC_RELOC;
 		  s->owner->flags |= HAS_RELOC;
 		  s->reloc_count++;
-		  if (r->relent.sym_ptr_ptr == 0)
+		  if (r->relent.sym_ptr_ptr == 0 && section)
 		    {
 		      r->relent.sym_ptr_ptr = section->symbol_ptr_ptr;
 		    }
@@ -1987,8 +1987,11 @@ ieee_canonicalize_reloc (abfd, section, 
 	    symbols + src->symbol.index + ieee->external_reference_base_offset;
 	  break;
 	case 0:
-	  src->relent.sym_ptr_ptr =
-	    src->relent.sym_ptr_ptr[0]->section->symbol_ptr_ptr;
+	  if (src->relent.sym_ptr_ptr)
+	    src->relent.sym_ptr_ptr =
+	      src->relent.sym_ptr_ptr[0]->section->symbol_ptr_ptr;
+	  else
+	    src->relent.sym_ptr_ptr = 0;
 	  break;
 	default:
 
@@ -3642,9 +3645,11 @@ ieee_generic_stat_arch_elt (abfd, buf)
      bfd *abfd;
      struct stat *buf;
 {
-  ieee_ar_data_type *ar = abfd->my_archive->tdata.ieee_ar_data;
+  ieee_ar_data_type *ar = (ieee_ar_data_type *) NULL;
   ieee_data_type *ieee;
 
+  if (abfd->my_archive)
+    ar = abfd->my_archive->tdata.ieee_ar_data;
   if (ar == (ieee_ar_data_type *) NULL)
     {
       bfd_set_error (bfd_error_invalid_operation);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-03-23  4:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-23  4:56 [gas-980322]: Bugs in IEEE handling - patch included Manfred Hollstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).