This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Plugin related segfault
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 4 Nov 2010 23:14:27 +1030
- Subject: Plugin related segfault
Fixes a segfault when plugin_multiple_definition calls is_ir_dummy_bfd
with a NULL abfd. Symbols can be defined in the absolute section,
which has a NULL owner.
* plugin.c (is_ir_dummy_bfd): Don't segfault on NULL abfd.
Index: ld/plugin.c
===================================================================
RCS file: /cvs/src/src/ld/plugin.c,v
retrieving revision 1.5
diff -u -p -r1.5 plugin.c
--- ld/plugin.c 25 Oct 2010 06:22:50 -0000 1.5
+++ ld/plugin.c 4 Nov 2010 12:37:23 -0000
@@ -245,7 +245,11 @@ plugin_get_ir_dummy_bfd (const char *nam
bfd_boolean
is_ir_dummy_bfd (const bfd *abfd)
{
- size_t namlen = strlen (abfd->filename);
+ size_t namlen;
+
+ if (abfd == NULL)
+ return FALSE;
+ namlen = strlen (abfd->filename);
if (namlen < IRONLY_SUFFIX_LEN)
return FALSE;
return !strcmp (abfd->filename + namlen - IRONLY_SUFFIX_LEN, IRONLY_SUFFIX);
--
Alan Modra
Australia Development Lab, IBM