aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-07-04 00:29:52 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-07-04 00:29:52 +0000
commit1c52a64577904012c953b9e992f2c1b4407a36d1 (patch)
tree5edfa4c91e587695aff514f557caa38ce558919c /bfd/elf.c
parent93a0472204eb29701468185d73ca2b01c3fba62c (diff)
downloadgdb-1c52a64577904012c953b9e992f2c1b4407a36d1.zip
gdb-1c52a64577904012c953b9e992f2c1b4407a36d1.tar.gz
gdb-1c52a64577904012c953b9e992f2c1b4407a36d1.tar.bz2
Check number of sections overflow
* elf.c (assign_section_numbers): Check if number of sections >= SHN_LORESERVE. * elfcode.h (elf_object_p): Likewise.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 532c7f9..48e5d68 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));