This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: minor som.c fix for --enable-targets=all


I configure binutils using --enable-targets=all.

If I invoke objdump on a SOM object, I get a crash:

barimba. ~/gnu/baseline-gdb/build/binutils/objdump -h /tmp/arrayidx 
Segmentation fault (core dumped)

The bug here is that som_is_subspace doesn't handle the case where
som_section_data returns NULL.

This patch fixes the crash for me.
Ok?

Tom

>From bb0f0921237e93961daf096dacfec8c5154ca428 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Tue, 18 Dec 2012 11:30:47 -0700
Subject: [PATCH 01/17] fix crash with multi-target bfd and som

	* som.c (som_is_subspace): Handle case where som_section_data
	returns NULL.
---
 bfd/som.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/bfd/som.c b/bfd/som.c
index 87aa88f..f16ec96 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -2686,7 +2686,8 @@ som_is_subspace (asection *section)
 {
   /* If no copy data is available, then it's neither a space nor a
      subspace.  */
-  if (som_section_data (section)->copy_data == NULL)
+  if (som_section_data (section) == NULL
+      || som_section_data (section)->copy_data == NULL)
     return FALSE;
 
   /* If the containing space is the same as the given section,
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]