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]

Re: [patch] elf32-i386.c, check for null


On Wed, Jul 25, 2007 at 06:23:28PM -0700, msnyder@sonic.net wrote:
> The function checks for h == NULL elsewhere, I assume it needs to
> be checked here too (since the call will dereference it).
> 

> 2007-07-25  Michael Snyder  <msnyder@access-company.com>
> 
> 	* elf32-i386.c (elf_i386_check_relocs): Check for null pointer.
> 
> Index: elf32-i386.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf32-i386.c,v
> retrieving revision 1.174
> diff -p -r1.174 elf32-i386.c
> *** elf32-i386.c	3 Jul 2007 14:26:41 -0000	1.174
> --- elf32-i386.c	26 Jul 2007 01:20:28 -0000
> *************** elf_i386_check_relocs (bfd *abfd,
> *** 1277,1284 ****
>   	  /* This relocation describes which C++ vtable entries are actually
>   	     used.  Record for later use during GC.  */
>   	case R_386_GNU_VTENTRY:
> ! 	  if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset))
> ! 	    return FALSE;
>   	  break;
>   
>   	default:
> --- 1277,1285 ----
>   	  /* This relocation describes which C++ vtable entries are actually
>   	     used.  Record for later use during GC.  */
>   	case R_386_GNU_VTENTRY:
> ! 	  if (h != NULL)
> ! 	    if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset))
> ! 	      return FALSE;
>   	  break;
>   
>   	default:

I prefer BFD_ASSERT (h != NULL) and R_386_GNU_VTINHERIT has the same
issue. 


H.J.


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