[PATCH] Further bfd robustification

Nick Clifton nickc@redhat.com
Thu Jun 16 09:42:00 GMT 2005


Hi Jakub,

> 2005-06-14  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* elf.c (bfd_section_from_shdr): Fail if sh_entsize is bogus for
> 	symbol, relocation, group or versym sections.
> 
> 	* coffcode.h (coff_slurp_reloc_table): Don't crash if native_relocs
> 	is NULL.
> 	* peXXigen.c (pe_print_idata): Don't crash if dll_name or start_address
> 	doesn't point into the section.

Just one small issue:

>      case SHT_GNU_versym:
> +      if (hdr->sh_entsize != 2)
> +	return FALSE;

> @@ -2057,6 +2065,8 @@ bfd_section_from_shdr (bfd *abfd, unsign
>        /* We need a BFD section for objcopy and relocatable linking,
>  	 and it's handy to have the signature available as the section
>  	 name.  */
> +      if (hdr->sh_entsize != 4)
> +	return FALSE;

I really think that these magic values ought to be defined macro 
constants declared in a header file somewhere (include/elf/common.h ?).

Cheers
   Nick



More information about the Binutils mailing list