From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19458 invoked by alias); 3 Jan 2014 12:59:33 -0000 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 Received: (qmail 19445 invoked by uid 89); 3 Jan 2014 12:59:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e24smtp04.br.ibm.com Received: from e24smtp04.br.ibm.com (HELO e24smtp04.br.ibm.com) (32.104.18.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 03 Jan 2014 12:59:31 +0000 Received: from /spool/local by e24smtp04.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Jan 2014 10:59:27 -0200 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp04.br.ibm.com (10.172.0.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 3 Jan 2014 10:59:25 -0200 Received: from d24relay03.br.ibm.com (d24relay03.br.ibm.com [9.13.184.25]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id 1BF343520064 for ; Fri, 3 Jan 2014 07:59:23 -0500 (EST) Received: from d24av03.br.ibm.com (d24av03.br.ibm.com [9.8.31.95]) by d24relay03.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s03CwvUD39714842 for ; Fri, 3 Jan 2014 10:58:58 -0200 Received: from d24av03.br.ibm.com (localhost [127.0.0.1]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s03CxNiH025929 for ; Fri, 3 Jan 2014 10:59:23 -0200 Received: from grandaddy.ibm.com ([9.78.142.205]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s03CxNCH025924; Fri, 3 Jan 2014 10:59:23 -0200 From: Edjunior Barbosa Machado To: gdb-patches@sourceware.org Cc: nickc@redhat.com Subject: [PATCH] Fix copy of filename in bfd's filename field Date: Fri, 03 Jan 2014 12:59:00 -0000 Message-Id: <1388753936-2835-1-git-send-email-emachado@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14010312-8936-0000-0000-00000C5053A9 X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00006.txt.bz2 Hi, in my recent tests, upstream gdb was crashing with the following: $ ./gdb ./testsuite/gdb.base/break -q -ex run Reading symbols from ./testsuite/gdb.base/break...done. Starting program: /home/emachado/devel/gdb/binutils-gdb.git/build/gdb/testsuite/gdb.base/break *** glibc detected *** ./gdb: double free or corruption (out): 0x088efc80 *** ======= Backtrace: ========= /lib/i386-linux-gnu/libc.so.6(+0x75ee2)[0xb72c9ee2] ./gdb[0x83583e9] ./gdb(bfd_close+0x99)[0x8358c81] ./gdb[0x821ba50] ... It was caused by this commit 1be509 on binutils code (https://sourceware.org/ml/binutils-cvs/2014-01/msg00003.html) which is now using xstrdup to store a copy of filename in bfd struct. The patch below fixes this problem on gdb side. Ok? Thanks, -- Edjunior gdb/ 2014-01-03 Edjunior Barbosa Machado * gdb_bfd.c (gdb_bfd_stash_filename): Fix copy of filename in bfd's filename field using xstrdup. --- gdb/gdb_bfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index 36c4630..1b290c2 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -69,7 +69,7 @@ gdb_bfd_stash_filename (struct bfd *abfd) strcpy (data, name); /* Unwarranted chumminess with BFD. */ - abfd->filename = data; + abfd->filename = xstrdup (data); } /* An object of this type is stored in each BFD's user data. */ -- 1.7.9.5