* elf.c (bfd_section_from_shdr): Fail if name is NULL.

Prevent endless recursion on broken objects.

	* archive.c (do_slurp_coff_armap): Check for overflows.
This commit is contained in:
Jakub Jelinek
2005-06-14 11:04:22 +00:00
parent 58b9a773e1
commit 933d961a3c
3 changed files with 22 additions and 0 deletions

View File

@ -821,9 +821,15 @@ do_slurp_coff_armap (bfd *abfd)
/* The coff armap must be read sequentially. So we construct a
bsd-style one in core all at once, for simplicity. */
if (nsymz > ~ (bfd_size_type) 0 / sizeof (carsym))
return FALSE;
carsym_size = (nsymz * sizeof (carsym));
ptrsize = (4 * nsymz);
if (carsym_size + stringsize + 1 <= carsym_size)
return FALSE;
ardata->symdefs = bfd_zalloc (abfd, carsym_size + stringsize + 1);
if (ardata->symdefs == NULL)
return FALSE;