From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32466 invoked by alias); 21 Jul 2008 05:08:54 -0000 Received: (qmail 32454 invoked by uid 22791); 21 Jul 2008 05:08:53 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 21 Jul 2008 05:08:28 +0000 Received: from zps18.corp.google.com (zps18.corp.google.com [172.25.146.18]) by smtp-out.google.com with ESMTP id m6L58FuD002664; Mon, 21 Jul 2008 06:08:16 +0100 Received: from localhost (cgda.corp.google.com [172.18.116.66]) by zps18.corp.google.com with ESMTP id m6L58Co6022143; Sun, 20 Jul 2008 22:08:14 -0700 Received: by localhost (Postfix, from userid 56346) id 2ECCC306D3; Sun, 20 Jul 2008 22:08:12 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [commited patch] fix ELF segment vs. loadable section check Cc: cgd@google.com, sposelenov@emcraft.com Message-Id: <20080721050812.2ECCC306D3@localhost> Date: Mon, 21 Jul 2008 05:08:00 -0000 From: cgd@google.com (Chris Demetriou) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-07/txt/msg00389.txt.bz2 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 Chris Demetriou * 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;