public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
To: binutils@sources.redhat.com
Subject: [PATCH] Prevent ld segementation fault
Date: Thu, 16 Dec 2004 10:43:00 -0000	[thread overview]
Message-ID: <20041216104256.GA21855@ahab.auto.tuwien.ac.at> (raw)

vfinfo (ldmisc.c) assumes that for %B a valid bfd handle is passed as parameter.
If the bfd handle is NULL, it will segfault.
reloc_overflow (ldmain.c) passes the content of entry->u.def.section->owner
to vfinfo to be printed with %B. If the entry is in the absolute section *ABS*,
it has no associated bfd. Therefore ld will produce an segmentation fault.

Can something like the following patch be applied to the CVS?
(All it does, is to print a default value, if abfd is NULL).
Or is there a better solution to fix this problem?

Index: ldmisc.c
===================================================================
RCS file: /cvs/src/src/ld/ldmisc.c,v
retrieving revision 1.20
diff -u -r1.20 ldmisc.c
--- ldmisc.c	13 Aug 2004 03:16:01 -0000	1.20
+++ ldmisc.c	16 Dec 2004 10:21:46 -0000
@@ -188,7 +188,9 @@
 	      /* filename from a bfd */
 	      {
 		bfd *abfd = va_arg (arg, bfd *);
-		if (abfd->my_archive)
+		if (abfd == NULL)
+		  fprintf (fp, "<none>");
+		else if (abfd->my_archive)
 		  fprintf (fp, "%s(%s)", abfd->my_archive->filename,
 			   abfd->filename);
 		else


mfg Martin Kögler
e9925248@stud4.tuwien.ac.at

             reply	other threads:[~2004-12-16 10:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-16 10:43 Martin Koegler [this message]
2004-12-16 15:42 ` Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041216104256.GA21855@ahab.auto.tuwien.ac.at \
    --to=mkoegler@auto.tuwien.ac.at \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).