public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH]: Catch sh_insn_info() returning NULL
@ 2006-07-13  9:07 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2006-07-13  9:07 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-07-13  9:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-13  9:07 [PATCH]: Catch sh_insn_info() returning NULL Nick Clifton

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).