{
struct elf_strtab_hash_entry *entry;
- if (idx == 0)
+ if (idx == 0 || idx >= tab->size || tab->sec_size == 0)
return 0;
- BFD_ASSERT (idx < tab->size);
- BFD_ASSERT (tab->sec_size);
entry = tab->array[idx];
- BFD_ASSERT (entry->refcount > 0);
+ if (entry == NULL || entry->refcount == 0)
+ return 0;
entry->refcount--;
return tab->array[idx]->u.index;
}
{
/* Don't set the sh_name field without section header. */
if ((abfd->flags & BFD_NO_SECTION_HEADER) == 0)
- i_shdrp[count]->sh_name
- = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
- i_shdrp[count]->sh_name);
+ {
+ i_shdrp[count]->sh_name
+ = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
+ i_shdrp[count]->sh_name);
+ /* FIXME: If we could not set the section name, should we tell the user ? */
+ }
if (bed->elf_backend_section_processing)
if (!(*bed->elf_backend_section_processing) (abfd, i_shdrp[count]))
return false;