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]

[PATCH] merge.c fix


Hi!

I've commited the following patch. _bfd_merged_section_offset could access
a byte before secinfo->contents and segfault if secinfo->contents pointed
at start of an mmap area before figuring out it is at start of section.

2002-07-04  Jakub Jelinek  <jakub@redhat.com>

	* merge.c (_bfd_merged_section_offset): Avoid accessing byte before
	section content start.
	Reported by Michael Schumacher <mike@hightec-rt.com>.

--- bfd/merge.c.jj	Tue Jun 18 09:59:05 2002
+++ bfd/merge.c	Thu Jul  4 18:13:07 2002
@@ -912,7 +912,7 @@ _bfd_merged_section_offset (output_bfd, 
       if (sec->entsize == 1)
 	{
 	  p = secinfo->contents + offset + addend - 1;
-	  while (*p && p >= secinfo->contents)
+	  while (p >= secinfo->contents && *p)
 	    --p;
 	  ++p;
 	}

	Jakub


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