This is the mail archive of the binutils-cvs@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]

[binutils-gdb] Also check that the group header's sh_info field is valid.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c09ec62dde0fa128994402ddb09c3d0dfcd35e40

commit c09ec62dde0fa128994402ddb09c3d0dfcd35e40
Author: Nick Clifton <nickc@redhat.com>
Date:   Thu Jun 2 16:32:45 2016 +0100

    Also check that the group header's sh_info field is valid.
    
    	PR 20089
    	* objcopy.c (group_signature): Fail if the input symbol table has
    	not been loaded, or if the sh_info field of the group header is 0.

Diff:
---
 binutils/ChangeLog | 2 +-
 binutils/objcopy.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index a91b99b..f8e7c76 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -2,7 +2,7 @@
 
 	PR 20089
 	* objcopy.c (group_signature): Fail if the input symbol table has
-	not been loaded.
+	not been loaded, or if the sh_info field of the group header is 0.
 
 	* dwarf.c (display_debug_frames): Do not display any
 	interpretation if the block consists solely of DW__CFA_NOPs.
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 98332cd..06fcea3 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1139,7 +1139,8 @@ group_signature (asection *group)
       Elf_Internal_Shdr *symhdr = elf_elfsections (abfd) [ghdr->sh_link];
 
       if (symhdr->sh_type == SHT_SYMTAB
-	  && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
+	  && ghdr->sh_info > 0
+	  && ghdr->sh_info < (symhdr->sh_size / bed->s->sizeof_sym))
 	return isympp[ghdr->sh_info - 1];
     }
   return NULL;


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