X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf.c;h=6aaa96f83f6228d535138164b4e55d950402ef74;hb=327ef784ba105f067f5c1d587908259d7aabb971;hp=2a299f15f00454b13e349fb0d94bade412bb48f0;hpb=68e52bc7ecfbfdc8d5f85716a8ac7668e211f360;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf.c b/bfd/elf.c index 2a299f15f0..6aaa96f83f 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -12592,13 +12592,31 @@ _bfd_elf_copy_special_section_fields (const bfd * ibfd ATTRIBUTE_UNUSED, } /* Find the output section that corresponds to the isection's sh_info link. */ - BFD_ASSERT (isection->sh_info > 0 - && isection->sh_info < elf_numsections (ibfd)); + if (isection->sh_info == 0 + || isection->sh_info >= elf_numsections (ibfd)) + { + _bfd_error_handler + /* xgettext:c-format */ + (_("%pB(%pA): info section index is invalid"), + obfd, osec); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + isection = elf_elfsections (ibfd)[isection->sh_info]; - BFD_ASSERT (isection != NULL); - BFD_ASSERT (isection->bfd_section != NULL); - BFD_ASSERT (isection->bfd_section->output_section != NULL); + if (isection == NULL + || isection->bfd_section == NULL + || isection->bfd_section->output_section == NULL) + { + _bfd_error_handler + /* xgettext:c-format */ + (_("%pB(%pA): info section index cannot be set because the section is not in the output"), + obfd, osec); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + osection->sh_info = elf_section_data (isection->bfd_section->output_section)->this_idx;