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]

gold patch committed: Ignore empty reloc sections


This patch to gold ignores empty reloc sections when reading relocs,
rather than crashing when it tries to get a zero-sized view.  Committed
to mainline.

Ian


2011-05-30  Ian Lance Taylor  <iant@google.com>

	* reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
	sections.


Index: reloc.cc
===================================================================
RCS file: /cvs/src/src/gold/reloc.cc,v
retrieving revision 1.66
diff -p -u -r1.66 reloc.cc
--- reloc.cc	24 May 2011 21:41:10 -0000	1.66
+++ reloc.cc	31 May 2011 04:25:52 -0000
@@ -322,6 +322,9 @@ Sized_relobj_file<size, big_endian>::do_
 
       off_t sh_size = shdr.get_sh_size();
 
+      if (sh_size == 0)
+	continue;
+
       unsigned int reloc_size;
       if (sh_type == elfcpp::SHT_REL)
 	reloc_size = elfcpp::Elf_sizes<size>::rel_size;

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