From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25679 invoked by alias); 10 Aug 2010 22:17:37 -0000 Received: (qmail 25663 invoked by uid 22791); 10 Aug 2010 22:17:36 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 Aug 2010 22:17:23 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7AMGa1D004816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 10 Aug 2010 18:16:36 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7AMGaBp012363; Tue, 10 Aug 2010 18:16:36 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o7AMGZvE011697; Tue, 10 Aug 2010 18:16:35 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 02A803781A0; Tue, 10 Aug 2010 16:16:34 -0600 (MDT) From: Tom Tromey To: Brad Roberts Cc: gdb-patches@sourceware.org Subject: Re: patch for crash in d-lang.c's demangler References: <4C55E1CE.5000301@puremagic.com> Date: Tue, 10 Aug 2010 22:17:00 -0000 In-Reply-To: <4C55E1CE.5000301@puremagic.com> (Brad Roberts's message of "Sun, 01 Aug 2010 14:06:22 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2010-08/txt/msg00134.txt.bz2 >>>>> "Brad" == Brad Roberts writes: Brad> There's a minor, but important bug in the d language symbol Brad> demangler. I haven't reviewed the whole thing for other bugs, Brad> just the one that I hit. Thanks. Brad> I don't have a copyright assignment form on file, but hopefully Brad> this diff is small enough to not require one. Yes, I agree. I think your patch is reasonable, but the line just after your change is weird: > if (i <= 0 && strlen (mangled_str) < i) > return 0; I don't think that condition can ever be true. What do you think of this patch, instead? Tom *** d-lang.c.~1.1.~ 2010-04-29 08:45:38.000000000 -0600 --- d-lang.c 2010-08-10 16:14:51.000000000 -0600 *************** *** 37,45 **** while (isdigit (*mangled_str)) { ! i = strtol (mangled_str, NULL, 10); ! mangled_str++; ! if (i <= 0 && strlen (mangled_str) < i) return 0; obstack_grow (tempbuf, mangled_str, i); mangled_str += i; --- 37,47 ---- while (isdigit (*mangled_str)) { ! char *end_ptr; ! ! i = strtol (mangled_str, &end_ptr, 10); ! mangled_str = end_ptr; ! if (i <= 0 || strlen (mangled_str) < i) return 0; obstack_grow (tempbuf, mangled_str, i); mangled_str += i;