* elf.c (_bfd_elf_get_symtab_upper_bound): Leave space for

terminating NULL if empty symbol table.
	(_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
This commit is contained in:
Alan Modra
2002-03-27 00:16:54 +00:00
parent cfed07154c
commit b99d18333d
2 changed files with 12 additions and 2 deletions

View File

@@ -1,3 +1,9 @@
2002-03-27 Gregory Steuck <greg@nest.cx>
* elf.c (_bfd_elf_get_symtab_upper_bound): Leave space for
terminating NULL if empty symbol table.
(_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
2002-03-26 H.J. Lu (hjl@gnu.org)
* elflink.h (elf_link_input_bfd): Revert the last change since

View File

@@ -5113,7 +5113,9 @@ _bfd_elf_get_symtab_upper_bound (abfd)
Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->symtab_hdr;
symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *));
symtab_size = (symcount + 1) * (sizeof (asymbol *));
if (symcount > 0)
symtab_size -= sizeof (asymbol *);
return symtab_size;
}
@@ -5133,7 +5135,9 @@ _bfd_elf_get_dynamic_symtab_upper_bound (abfd)
}
symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *));
symtab_size = (symcount + 1) * (sizeof (asymbol *));
if (symcount > 0)
symtab_size -= sizeof (asymbol *);
return symtab_size;
}