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]

PATCH COMMITTED: Check for invalid section group


It seems to me that between 2004-04-30 and 2004-11-24 the GNU binutils
could produce invalid SHT_GROUP sections, in that the section header
did not precede the headers for the sections in the group.  There
don't seem to have been any binutils releases in that time.
Nevertheless, somebody has shown me an object file with this problem.
They don't work with gold, which for efficiency assumes it can rely on
the guarantee in the ELF ABI.

gold may need to handle this at some point.  In the meantime, and
perhaps forever, I committed this patch to give an error for this
case.

Ian


2008-04-23  Ian Lance Taylor  <iant@google.com>

	* object.cc (Sized_relobj::include_section_group): Check for
	invalid section group.


Index: object.cc
===================================================================
RCS file: /cvs/src/src/gold/object.cc,v
retrieving revision 1.71
diff -u -p -u -r1.71 object.cc
--- object.cc	23 Apr 2008 17:32:53 -0000	1.71
+++ object.cc	23 Apr 2008 17:39:35 -0000
@@ -609,6 +609,13 @@ Sized_relobj<size, big_endian>::include_
 		      secnum, index);
 	  continue;
 	}
+
+      // Check for an earlier section number, since we're going to get
+      // it wrong--we may have already decided to include the section.
+      if (secnum < index)
+        this->error(_("invalid section group %u refers to earlier section %u"),
+                    index, secnum);
+
       (*omit)[secnum] = true;
     }
 

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