From 42bbd4001b73004ea4555221e51af4b824033c54 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 4 Jul 2012 00:29:50 +0000 Subject: Check number of sections overflow * elf.c (assign_section_numbers): Check if number of sections >= SHN_LORESERVE. * elfcode.h (elf_object_p): Likewise. --- bfd/elf.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bfd/elf.c') diff --git a/bfd/elf.c b/bfd/elf.c index 532c7f99f3..48e5d68341 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -3014,6 +3014,13 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->strtab_hdr.sh_name); } + if (section_number >= SHN_LORESERVE) + { + _bfd_error_handler (_("%B: too many sections: %u"), + abfd, section_number); + return FALSE; + } + _bfd_elf_strtab_finalize (elf_shstrtab (abfd)); t->shstrtab_hdr.sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd)); -- cgit v1.2.1