From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19785 invoked by alias); 22 Jul 2012 19:41:11 -0000 Received: (qmail 19775 invoked by uid 22791); 22 Jul 2012 19:41:11 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-out.m-online.net (HELO mail-out.m-online.net) (212.18.0.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 22 Jul 2012 19:40:58 +0000 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3WgGQw5WvHz3hhWG; Sun, 22 Jul 2012 21:40:55 +0200 (CEST) X-Auth-Info: W35AZq2SWH76uk8cC0rCCVfPSH9RtiYOgiEQKDmNzqs= Received: from igel.home (ppp-93-104-154-252.dynamic.mnet-online.de [93.104.154.252]) by mail.mnet-online.de (Postfix) with ESMTPA id 3WgGQv5blVzbbtl; Sun, 22 Jul 2012 21:40:55 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id 6E5ECCA2A4; Sun, 22 Jul 2012 21:40:55 +0200 (CEST) From: Andreas Schwab To: Tom Tromey Cc: Joel Brobecker , gdb-patches@sourceware.org Subject: Re: creating the gdb-7.4 branch tomorrow (?) References: <20111205081911.GG28486@adacore.com> X-Yow: Hmmm... an arrogant bouquet with a subtle suggestion of POLYVINYL CHLORIDE... Date: Sun, 22 Jul 2012 19:41:00 -0000 In-Reply-To: (Tom Tromey's message of "Tue, 06 Dec 2011 10:41:32 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 2012-07/txt/msg00435.txt.bz2 Tom Tromey writes: > +static void > +filter_sals (struct symtabs_and_lines *sals) > +{ > + int i, out, prev; > + > + out = 0; > + for (i = 0; i < sals->nelts; ++i) > + { > + if (sals->sals[i].pspace == current_program_space > + || sals->sals[i].symtab == NULL) > + { > + sals->sals[out] = sals->sals[i]; > + ++out; > + } > + } > + sals->nelts = out; > + > + qsort (sals->sals, sals->nelts, sizeof (struct symtab_and_line), > + compare_symtabs); > + > + out = 1; > + prev = 0; > + for (i = 1; i < sals->nelts; ++i) > + { > + if (compare_symtabs (&sals->sals[prev], &sals->sals[i])) > + { > + /* Symtabs differ. */ > + sals->sals[out] = sals->sals[i]; > + prev = out; > + ++out; > + } > + } > + sals->nelts = out; > + > + if (sals->nelts == 0) This is never true. If sals->nelts == 0 on entry then it will always be set to 1, causing the caller to crash when dereferencing sals->sals. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."