This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR 7023, sparc ld memory exhausted


Apparently some versions of the Sun assembler generate zero size
.symtab with a sh_info of one.  This leads to GNU ld trying to
malloc(-1).  I believe older versions of GNU ld would do exactly the
same so this must be a new problem with Sun as.  Unless shown
otherwise, I don't think this is worth adding a workaround.

	PR 7023
	* elf.c (bfd_section_from_shdr <SHT_SYMTAB>): Fail on invalid sh_info.

Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.468
diff -u -p -r1.468 elf.c
--- bfd/elf.c	11 Nov 2008 04:26:13 -0000	1.468
+++ bfd/elf.c	12 Nov 2008 21:47:28 -0000
@@ -1608,6 +1608,8 @@ bfd_section_from_shdr (bfd *abfd, unsign
 
       if (hdr->sh_entsize != bed->s->sizeof_sym)
 	return FALSE;
+      if (hdr->sh_info * hdr->sh_entsize > hdr->sh_size)
+	return FALSE;
       BFD_ASSERT (elf_onesymtab (abfd) == 0);
       elf_onesymtab (abfd) = shindex;
       elf_tdata (abfd)->symtab_hdr = *hdr;

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]