This is the mail archive of the binutils@sources.redhat.com 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]

[drow@mvista.com: Re: make check fails on i686-linux-gnu]


Oops, meant to CC the list on this.

I didn't notice the "dynamic" parameter;
elf_slurp_reloc_table_from_section can work on the normal or dynamic
symbols.  This patch fixes it to check the right count for overflow. 
No gas/ld/binutils testsuite failures after it's applied; committed as
obvious-in-hindsight.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2002-09-18  Daniel Jacobowitz  <drow@mvista.com>

	* elfcode.h (elf_slurp_reloc_table_from_section): Check
	correct relocation count.

Index: elfcode.h
===================================================================
RCS file: /cvs/src/src/bfd/elfcode.h,v
retrieving revision 1.34
diff -u -p -r1.34 elfcode.h
--- elfcode.h	18 Sep 2002 02:39:43 -0000	1.34
+++ elfcode.h	18 Sep 2002 13:24:14 -0000
@@ -1377,6 +1377,7 @@ elf_slurp_reloc_table_from_section (abfd
   arelent *relent;
   unsigned int i;
   int entsize;
+  long symcount;
 
   allocated = (PTR) bfd_malloc (rel_hdr->sh_size);
   if (allocated == NULL)
@@ -1419,9 +1420,14 @@ elf_slurp_reloc_table_from_section (abfd
       else
 	relent->address = rela.r_offset - asect->vma;
 
+      if (dynamic)
+	symcount = bfd_get_dynamic_symcount (abfd);
+      else
+	symcount = bfd_get_symcount (abfd);
+
       if (ELF_R_SYM (rela.r_info) == 0)
 	relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
-      else if (ELF_R_SYM (rela.r_info) > bfd_get_dynamic_symcount (abfd))
+      else if (ELF_R_SYM (rela.r_info) > symcount)
 	{
 	  (*_bfd_error_handler)
 	    (_("%s(%s): relocation %d has invalid symbol index %ld"),


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