summaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-06-14 11:04:22 +0000
committerJakub Jelinek <jakub@redhat.com>2005-06-14 11:04:22 +0000
commit59f0101e336f34b130ea987fdfd9a07ae2556f47 (patch)
tree7f4478af60a18ec0ed88e8259282937a0651e3f1 /bfd/archive.c
parentae0aedce702546084cbe88c4cc857e1eb479e568 (diff)
downloadgdb-59f0101e336f34b130ea987fdfd9a07ae2556f47.tar.gz
* 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.
Diffstat (limited to 'bfd/archive.c')
-rw-r--r--bfd/archive.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index 7dfe6b6726d..ce6a3328577 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -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;