From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5916 invoked by alias); 16 Dec 2004 10:43:24 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 5788 invoked from network); 16 Dec 2004 10:43:01 -0000 Received: from unknown (HELO mr.tuwien.ac.at) (128.131.2.109) by sourceware.org with SMTP; 16 Dec 2004 10:43:01 -0000 Received: from ahab.auto.tuwien.ac.at (ahab.auto.tuwien.ac.at [128.130.60.8]) by mr.tuwien.ac.at (8.12.10/8.12.8) with ESMTP id iBGAgujZ011210 for ; Thu, 16 Dec 2004 11:42:57 +0100 (MET) Received: from ahab.auto.tuwien.ac.at (localhost.localdomain [127.0.0.1]) by ahab.auto.tuwien.ac.at (8.12.11/8.12.11) with ESMTP id iBGAgu7n032316 for ; Thu, 16 Dec 2004 11:42:56 +0100 Received: (from mkoegler@localhost) by ahab.auto.tuwien.ac.at (8.12.11/8.12.11/Submit) id iBGAguPw032313 for binutils@sources.redhat.com; Thu, 16 Dec 2004 11:42:56 +0100 Date: Thu, 16 Dec 2004 10:43:00 -0000 From: Martin Koegler To: binutils@sources.redhat.com Subject: [PATCH] Prevent ld segementation fault Message-ID: <20041216104256.GA21855@ahab.auto.tuwien.ac.at> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.4.1i X-SW-Source: 2004-12/txt/msg00178.txt.bz2 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, ""); + 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