This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: PR ld/12364: Segmentation fault in get_symbols
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Date: Wed, 5 Jan 2011 06:27:00 -0800
- Subject: PATCH: PR ld/12364: Segmentation fault in get_symbols
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
We should check if owner_sec->owner is NULL before accessing its flags
field. Checked in as an obvious fix.
H.J.
---
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 8644b45..e9e8898 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/12364
+ * plugin.c (get_symbols): Check if owner_sec->owner is NULL
+ before accessing its flags field.
+
2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
* ldver.c (ldversion): Update copyright to 2011.
diff --git a/ld/plugin.c b/ld/plugin.c
index 771a39f..377a840 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -514,7 +514,8 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms)
: LDPR_PREVAILING_DEF);
else if (is_ir_dummy_bfd (owner_sec->owner))
syms[n].resolution = LDPR_RESOLVED_IR;
- else if (owner_sec->owner->flags & DYNAMIC)
+ else if (owner_sec->owner != NULL
+ && (owner_sec->owner->flags & DYNAMIC) != 0)
syms[n].resolution = LDPR_RESOLVED_DYN;
else
syms[n].resolution = LDPR_RESOLVED_EXEC;