PR5900: corrupt e_shstrndx

Alan Modra amodra@bigpond.net.au
Wed Mar 25 01:38:00 GMT 2009


On Tue, Mar 24, 2009 at 03:15:15PM -0400, Ryan Mansfield wrote:
> Index: readelf.c
> ===================================================================
> RCS file: /cvs/src/src/binutils/readelf.c,v
> retrieving revision 1.441
> diff -c -3 -p -r1.441 readelf.c
> *** readelf.c   19 Mar 2009 14:42:52 -0000      1.441
> --- readelf.c   24 Mar 2009 18:43:13 -0000
> *************** process_file_header (void)
> *** 3205,3211 ****
>         if (section_headers != NULL
>           && elf_header.e_shstrndx == (SHN_XINDEX & 0xffff))
>         printf (" (%u)", section_headers[0].sh_link);
> !       else if (elf_header.e_shstrndx >= elf_header.e_shnum)
>         printf (" <corrupt: out of range>");
>         putc ('\n', stdout);
>       }
> --- 3205,3212 ----
>         if (section_headers != NULL
>           && elf_header.e_shstrndx == (SHN_XINDEX & 0xffff))
>         printf (" (%u)", section_headers[0].sh_link);
> !       else if (elf_header.e_shstrndx != SHN_UNDEF
> !                && elf_header.e_shstrndx >= elf_header.e_shnum)
>         printf (" <corrupt: out of range>");
>         putc ('\n', stdout);
>       }

Applied with this changelog

2009-03-25  Ryan Mansfield  <rmansfield@qnx.com>

	* readelf.c (process_file_header): Don't report a corrupt string
	table index if it is zero.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list