summaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-07-04 00:29:50 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-07-04 00:29:50 +0000
commit42bbd4001b73004ea4555221e51af4b824033c54 (patch)
tree9c39a9889381644924e165911f81c317d210eea4 /bfd/elfcode.h
parent509c2d431d775330e9cd4453b44212c4a0f29973 (diff)
downloadbinutils-redhat-42bbd4001b73004ea4555221e51af4b824033c54.tar.gz
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/elfcode.h')
-rw-r--r--bfd/elfcode.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index cc55c866d6..30bda73d86 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;
}