From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15597 invoked by alias); 3 Apr 2014 04:02:42 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 15574 invoked by uid 89); 3 Apr 2014 04:02:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-50.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL autolearn=no version=3.3.2 X-HELO: mho-01-ewr.mailhop.org Received: from mho-03-ewr.mailhop.org (HELO mho-01-ewr.mailhop.org) (204.13.248.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 03 Apr 2014 04:02:40 +0000 Received: from pool-173-76-43-57.bstnma.fios.verizon.net ([173.76.43.57] helo=cgf.cx) by mho-01-ewr.mailhop.org with esmtpa (Exim 4.72) (envelope-from ) id 1WVYrO-000DMs-6u; Thu, 03 Apr 2014 04:02:38 +0000 Received: from ednor (ednor.casa.cgf.cx [192.168.187.5]) by cgf.cx (Postfix) with SMTP id 3C3B6600CE; Thu, 3 Apr 2014 00:02:36 -0400 (EDT) Received: by ednor (sSMTP sendmail emulation); Thu, 03 Apr 2014 00:02:36 -0400 X-Mail-Handler: Dyn Standard SMTP by Dyn X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX19NFgsY8h556UUgEu/IVO8l Date: Thu, 03 Apr 2014 04:02:00 -0000 From: Christopher Faylor To: binutils@sourceware.org, Jon TURNEY Subject: Re: [PATCH 1/2] pe/coff: Avoid a crash using objdump -p on the output of objcopy --only-keep-debug Message-ID: <20140403040236.GA4644@ednor.casa.cgf.cx> Mail-Followup-To: binutils@sourceware.org, Jon TURNEY References: <1395153555-5572-1-git-send-email-jon.turney@dronecode.org.uk> <1395153555-5572-2-git-send-email-jon.turney@dronecode.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1395153555-5572-2-git-send-email-jon.turney@dronecode.org.uk> User-Agent: Mutt/1.5.20 (2009-06-14) X-SW-Source: 2014-04/txt/msg00033.txt.bz2 Nick are you ok with these patches? They seem ok to me. I'm sorry that I missed them previously. cgf On Tue, Mar 18, 2014 at 02:39:14PM +0000, Jon TURNEY wrote: >Avoid a crash when using objdump -p on the output of objcopy --only-keep-debug > >e.g. > >$ objdump -p /usr/lib/debug/usr/bin/cygwin1.dbg >[...] >The Export Tables (interpreted .edata section contents) > >Export Flags 0 >Time/Date stamp 0 >Major/Minor 0/0 >Segmentation fault (core dumped) > >Verfify that edt.name lies inside the .edata section we have loaded before >dereferencing it. Change adj to to bfd_vma to avoid signed vs. unsigned >comparison warnings - it could only be negative if a section had a negative >vma. > >bfd/Changelog: > >2014-03-18 Jon TURNEY > > * peXXigen.c (pe_print_edata): Verify edt.name lies inside > section before dereferencing. > >Signed-off-by: Jon TURNEY >--- > bfd/peXXigen.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c >index 8219ab9..d011c0e 100644 >--- a/bfd/peXXigen.c >+++ b/bfd/peXXigen.c >@@ -1373,7 +1373,7 @@ pe_print_edata (bfd * abfd, void * vfile) > bfd_size_type datasize = 0; > bfd_size_type dataoff; > bfd_size_type i; >- bfd_signed_vma adj; >+ bfd_vma adj; > struct EDT_type > { > long export_flags; /* Reserved - should be zero. */ >@@ -1478,8 +1478,12 @@ pe_print_edata (bfd * abfd, void * vfile) > fprintf (file, > _("Name \t\t\t\t")); > bfd_fprintf_vma (abfd, file, edt.name); >- fprintf (file, >+ >+ if ((edt.name >= adj) && (edt.name < adj + datasize)) >+ fprintf (file, > " %s\n", data + edt.name - adj); >+ else >+ fprintf (file, "(outside .edata section)\n"); > > fprintf (file, > _("Ordinal Base \t\t\t%ld\n"), edt.base); >-- >1.8.3.4 > >