From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1245 invoked by alias); 4 Sep 2007 14:18:38 -0000 Received: (qmail 1235 invoked by uid 22791); 4 Sep 2007 14:18:37 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 04 Sep 2007 14:18:32 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id AB8EC2AA8E6; Tue, 4 Sep 2007 10:18:30 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id v22RK7mjHE2Y; Tue, 4 Sep 2007 10:18:30 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 90C702AA8DF; Tue, 4 Sep 2007 10:18:30 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 5602CE7B58; Tue, 4 Sep 2007 07:18:30 -0700 (PDT) Date: Tue, 04 Sep 2007 14:18:00 -0000 From: Joel Brobecker To: msnyder@sonic.net Cc: gdb-patches@sourceware.org Subject: Re: [patch] gnu-v2-abi.c: strchr may return null Message-ID: <20070904141830.GC3579@adacore.com> References: <16934.12.7.175.2.1188422744.squirrel@webmail.sonic.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16934.12.7.175.2.1188422744.squirrel@webmail.sonic.net> User-Agent: Mutt/1.4.2.2i 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: 2007-09/txt/msg00046.txt.bz2 > 2007-08-29 Michael Snyder > > * gnu-v2-abi.c (gnuv2_value_rtti_type): Guard against null. This looks OK to me, but can you give it a few more days so that Daniel can provide any comment on it (C++ is not our main focus at AdaCore)? I'm thinking this is perhaps a case where an assert might be better: Does the rest of the function make any sense if we don't find our space? I don't know the encoding so perhaps it's OK to give it a try... > Index: gnu-v2-abi.c > =================================================================== > RCS file: /cvs/src/src/gdb/gnu-v2-abi.c,v > retrieving revision 1.25 > diff -p -r1.25 gnu-v2-abi.c > *** gnu-v2-abi.c 23 Aug 2007 18:08:33 -0000 1.25 > --- gnu-v2-abi.c 29 Aug 2007 21:24:09 -0000 > *************** gnuv2_value_rtti_type (struct value *v, > *** 192,198 **** > CORE_ADDR vtbl; > struct minimal_symbol *minsym; > struct symbol *sym; > ! char *demangled_name; > struct type *btype; > > if (full) > --- 192,198 ---- > CORE_ADDR vtbl; > struct minimal_symbol *minsym; > struct symbol *sym; > ! char *demangled_name, *p; > struct type *btype; > > if (full) > *************** gnuv2_value_rtti_type (struct value *v, > *** 252,258 **** > > /* If we just skip the prefix, we get screwed by namespaces */ > demangled_name=cplus_demangle(demangled_name,DMGL_PARAMS|DMGL_ANSI); > ! *(strchr(demangled_name,' '))=0; > > /* Lookup the type for the name */ > /* FIXME: chastain/2003-11-26: block=NULL is bogus. See pr gdb/1465. */ > --- 252,260 ---- > > /* If we just skip the prefix, we get screwed by namespaces */ > demangled_name=cplus_demangle(demangled_name,DMGL_PARAMS|DMGL_ANSI); > ! p = strchr (demangled_name, ' '); > ! if (p) > ! *p = '\0'; > > /* Lookup the type for the name */ > /* FIXME: chastain/2003-11-26: block=NULL is bogus. See pr gdb/1465. */ -- Joel