From 1c52a64577904012c953b9e992f2c1b4407a36d1 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 4 Jul 2012 00:29:52 +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/elfcode.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bfd/elfcode.h') diff --git a/bfd/elfcode.h b/bfd/elfcode.h index cc55c86..30bda73 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -633,8 +633,9 @@ elf_object_p (bfd *abfd) if (i_ehdrp->e_shnum == SHN_UNDEF) { i_ehdrp->e_shnum = i_shdr.sh_size; - if (i_ehdrp->e_shnum != i_shdr.sh_size - || i_ehdrp->e_shnum == 0) + if (i_ehdrp->e_shnum >= SHN_LORESERVE + || i_ehdrp->e_shnum != i_shdr.sh_size + || i_ehdrp->e_shnum == 0) goto got_wrong_format_error; } -- cgit v1.1