]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR binutils/13622
authorNick Clifton <nickc@redhat.com>
Mon, 30 Jan 2012 11:35:38 +0000 (11:35 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 30 Jan 2012 11:35:38 +0000 (11:35 +0000)
* readelf.c (process_section_groups): If there are no section
headers do not scan for section groups.
(process_note_sections): Likewise for note sections.

binutils/ChangeLog
binutils/readelf.c

index 2f5af61ba93c18b8a715c407b94e9a235e8b37ae..30101e5fde31e1e63b04edac8fdc55412b72201b 100644 (file)
@@ -1,3 +1,10 @@
+2012-01-26  Nick Clifton  <nickc@redhat.com>
+
+       PR binutils/13622
+       * readelf.c (process_section_groups): If there are no section
+       headers do not scan for section groups.
+       (process_note_sections): Likewise for note sections.
+
 2011-10-25  Alan Modra  <amodra@gmail.com>
 
        Apply mainline patches
index 9e13190b4e0e79f4649ae0e45c691d5c7c4fe86c..bf053d9228799844f1f6d2f56acda234bd1b8bc4 100644 (file)
@@ -4937,7 +4937,8 @@ process_section_groups (FILE * file)
   if (section_headers == NULL)
     {
       error (_("Section headers are not available!\n"));
-      abort ();
+      /* PR 13622: This can happen with a corrupt ELF header.  */
+      return 0;
     }
 
   section_headers_groups = (struct group **) calloc (elf_header.e_shnum,
@@ -12942,7 +12943,7 @@ process_note_sections (FILE * file)
   int res = 1;
 
   for (i = 0, section = section_headers;
-       i < elf_header.e_shnum;
+       i < elf_header.e_shnum && section != NULL;
        i++, section++)
     if (section->sh_type == SHT_NOTE)
       res &= process_corefile_note_segment (file,