Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > e48b84fbbca77f66810ded7d6ca3c54a > files > 6

gdb-6.3-3.1.102mdk.src.rpm

--- bfd/elfcode.h.orig	2005-05-04 19:34:52.000000000 -0400
+++ bfd/elfcode.h	2005-05-04 19:37:35.000000000 -0400
@@ -640,6 +640,9 @@
       Elf_Internal_Shdr *shdrp;
       unsigned int num_sec;
 
+      if (sizeof(*i_shdrp)*i_ehdrp->e_shnum/sizeof(*i_shdrp)!=i_ehdrp->e_shnum)
+	goto got_no_match;
+
       amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum;
       i_shdrp = bfd_alloc (abfd, amt);
       if (!i_shdrp)
@@ -647,6 +650,10 @@
       num_sec = i_ehdrp->e_shnum;
       if (num_sec > SHN_LORESERVE)
 	num_sec += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+
+      if (sizeof (i_shdrp) * num_sec/sizeof (i_shdrp) != num_sec)
+	goto got_no_match;
+
       elf_numsections (abfd) = num_sec;
       amt = sizeof (i_shdrp) * num_sec;
       elf_elfsections (abfd) = bfd_alloc (abfd, amt);