Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: cgd@google.com (Chris Demetriou)
To: gdb-patches@sourceware.org
Cc: cgd@google.com, sposelenov@emcraft.com
Subject: [commited patch] fix ELF segment vs. loadable section check
Date: Mon, 21 Jul 2008 05:08:00 -0000	[thread overview]
Message-ID: <20080721050812.2ECCC306D3@localhost> (raw)

This patch was originally sent by Sergei Poselenov in
http://sourceware.org/ml/gdb/2007-12/msg00146.html -- I just tested it
and added a changelog entry.

tested by...
 * build/check on i686-linux before after (no changes)
 * hand-crafted test case which triggered the warning before, verified
   that it went away after the fix.

committed as obvious.


chris
--
2008-07-20  Sergei Poselenov  <sposelenov@emcraft.com>
            Chris Demetriou  <cgd@google.com>

	* elfread.c (elf_symfile_segments): Fix the check that each loadable
	section fits within an ELF segment to handle ELF segments that hit
	the end of the address space.

Index: elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.72
diff -u -u -p -r1.72 elfread.c
--- elfread.c	14 May 2008 18:14:34 -0000	1.72
+++ elfread.c	21 Jul 2008 05:02:47 -0000
@@ -108,7 +108,7 @@ elf_symfile_segments (bfd *abfd)
       for (j = 0; j < num_segments; j++)
 	if (segments[j]->p_memsz > 0
 	    && vma >= segments[j]->p_vaddr
-	    && vma < segments[j]->p_vaddr + segments[j]->p_memsz)
+	    && (vma - segments[j]->p_vaddr) < segments[j]->p_memsz)
 	  {
 	    data->segment_info[i] = j + 1;
 	    break;


             reply	other threads:[~2008-07-21  5:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-21  5:08 Chris Demetriou [this message]
2008-07-21 11:50 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080721050812.2ECCC306D3@localhost \
    --to=cgd@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sposelenov@emcraft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox