diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elfcode.h | 13 |
2 files changed, 17 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d6069baafbc..2938fa0fe45 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2006-04-18 Nick Clifton <nickc@redhat.com> + + PR 2257 + * elfcode.h (elf_object_p): Allow files with corrupt e_shstrndx + fields to still be handled as ELF files. + 2006-04-16 Daniel Jacobowitz <dan@codesourcery.com> * po/SRC-POTFILES.in: Regenerated. diff --git a/bfd/elfcode.h b/bfd/elfcode.h index f7f85ba2056..9bb66e11c0c 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -742,9 +742,18 @@ elf_object_p (bfd *abfd) if (i_ehdrp->e_shstrndx >= elf_numsections (abfd) || (i_ehdrp->e_shstrndx >= SHN_LORESERVE && i_ehdrp->e_shstrndx <= SHN_HIRESERVE)) - goto got_wrong_format_error; + { + /* PR 2257: + We used to just goto got_wrong_format_error here + but there are binaries in existance for which this test + will prevent the binutils from working with them at all. + So we are kind, and reset the string index value to 0 + so that at least some processing can be done. */ + i_ehdrp->e_shstrndx = SHN_UNDEF; + _bfd_error_handler (_("warning: %s has a corrupt string table index - ignoring"), abfd->filename); + } } - else if (i_ehdrp->e_shstrndx != 0) + else if (i_ehdrp->e_shstrndx != SHN_UNDEF) goto got_wrong_format_error; /* Read in the program headers. */ |