diff options
author | Alan Modra <amodra@gmail.com> | 2018-05-08 14:32:04 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2018-05-08 22:29:39 +0930 |
commit | 886d542809fd73fba55ba72da1bd64ba50164222 (patch) | |
tree | c7be28e761b2f09d9a3e3f09ccd29b056b24c07d /binutils | |
parent | f413a91378902aadbe4e338a6dc8f33f5f7148a0 (diff) | |
download | binutils-886d542809fd73fba55ba72da1bd64ba50164222.zip binutils-886d542809fd73fba55ba72da1bd64ba50164222.tar.gz binutils-886d542809fd73fba55ba72da1bd64ba50164222.tar.bz2 |
PR23141, SIGSEGV in bfd_elf_set_group_contents
Another fuzzing fix. I think it's reasonable to simply strip out any
group section that is too weird for objcopy to handle.
PR 23141
* objcopy.c (is_strip_section): Strip groups without a valid
signature symbol.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 6 | ||||
-rw-r--r-- | binutils/objcopy.c | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 29fd1c2..d2d2553 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2018-05-08 Alan Modra <amodra@gmail.com> + + PR 23141 + * objcopy.c (is_strip_section): Strip groups without a valid + signature symbol. + 2018-05-07 Alan Modra <amodra@gmail.com> PR 23142 diff --git a/binutils/objcopy.c b/binutils/objcopy.c index fadc957..3563792 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1343,14 +1343,15 @@ is_strip_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) const char *gname; asection *elt, *first; + gsym = group_signature (sec); + /* Strip groups without a valid signature. */ + if (gsym == NULL) + return TRUE; + /* PR binutils/3181 If we are going to strip the group signature symbol, then strip the group section too. */ - gsym = group_signature (sec); - if (gsym != NULL) - gname = gsym->name; - else - gname = sec->name; + gname = gsym->name; if ((strip_symbols == STRIP_ALL && !is_specified_symbol (gname, keep_specific_htab)) || is_specified_symbol (gname, strip_specific_htab)) |