From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28015 invoked by alias); 13 Jul 2006 09:07:11 -0000 Received: (qmail 27818 invoked by uid 22791); 13 Jul 2006 09:07:10 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 13 Jul 2006 09:07:08 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k6D975if017363 for ; Thu, 13 Jul 2006 05:07:05 -0400 Received: from pobox.surrey.redhat.com (pobox.surrey.redhat.com [172.16.10.17]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k6D974RO018922 for ; Thu, 13 Jul 2006 05:07:05 -0400 Received: from localhost.localdomain.redhat.com (vpn-68-9.surrey.redhat.com [10.32.68.9]) by pobox.surrey.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k6D973iA002193 for ; Thu, 13 Jul 2006 10:07:04 +0100 To: binutils@sourceware.org Subject: [PATCH]: Catch sh_insn_info() returning NULL From: Nick Clifton Date: Thu, 13 Jul 2006 09:07:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00172.txt.bz2 Hi Guys, I am checking in the patch below to fix a seg-fault in an SH targeted linker that can occur when a call to sh_insn_info() returns NULL, but the return value was being used without being checked. (If it matters, the insns in question were 0x429e and 0xf2bd). Cheers Nick bfd/ChangeLog 2006-07-13 Nick Clifton * coff-sh.c (_bfd_sh_align_load_span): Catch sh_insn_info() returning a NULL value. Index: bfd/coff-sh.c =================================================================== RCS file: /cvs/src/src/bfd/coff-sh.c,v retrieving revision 1.33 diff -c -3 -p -r1.33 coff-sh.c *** bfd/coff-sh.c 4 May 2005 15:53:03 -0000 1.33 --- bfd/coff-sh.c 13 Jul 2006 09:04:04 -0000 *************** _bfd_sh_align_load_span (abfd, sec, cont *** 2510,2517 **** next2_insn = bfd_get_16 (abfd, contents + i + 4); next2_op = sh_insn_info (next2_insn); ! if ((next2_op->flags & (LOAD | STORE)) == 0 ! && sh_load_use (insn, op, next2_insn, next2_op)) ok = FALSE; } --- 2510,2518 ---- next2_insn = bfd_get_16 (abfd, contents + i + 4); next2_op = sh_insn_info (next2_insn); ! if (next2_op == NULL ! || ((next2_op->flags & (LOAD | STORE)) == 0 ! && sh_load_use (insn, op, next2_insn, next2_op))) ok = FALSE; }