public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: binutils@sourceware.org
Subject: [PATCH]: Catch sh_insn_info() returning NULL
Date: Thu, 13 Jul 2006 09:07:00 -0000	[thread overview]
Message-ID: <m3ejwpzxe0.fsf@redhat.com> (raw)

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  <nickc@redhat.com>

	* 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;
  		}
  

                 reply	other threads:[~2006-07-13  9:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3ejwpzxe0.fsf@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).