From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16618 invoked by alias); 6 Jan 2004 01:14:03 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 16605 invoked from network); 6 Jan 2004 01:14:03 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 6 Jan 2004 01:14:03 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id i061E2A21413 for ; Mon, 5 Jan 2004 20:14:02 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i061E1M20863; Mon, 5 Jan 2004 20:14:01 -0500 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id i061DwO04912; Mon, 5 Jan 2004 17:14:00 -0800 Message-ID: <3FFA0BD6.70805@redhat.com> Date: Tue, 06 Jan 2004 01:14:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 MIME-Version: 1.0 To: Pawel Ostrowski CC: gdb-patches@sources.redhat.com Subject: Re: [PATCH] segv fix when eof is typed in actions References: <20040102021243.GA28939@dixie.localdomain> In-Reply-To: <20040102021243.GA28939@dixie.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-01/txt/msg00128.txt.bz2 Pawel Ostrowski wrote: > Hello, > > GDB (snapshot 20031230) segfaults on the following script (and on any > program being debugged: int main() {return 0;} is enough): > > trace main > actions 1 > > > I have found out that typing EOF when editing tracepoint actions > causes gdb to segv. The segv is caused by dereferencing twice line > parameter (**line), when *line is NULL. I have added check for this > case to validate_actionline() in tracepoint.c, so it now ends actions > editing (just like you would have typed "end" instead of EOF). > > Some details of my configuration: > - gdb versions: 6.0, 20031230 snapshot, both compiled with gcc 3.3.2 > - uname -rmpo: 2.6.0 i686 AMD_Athlon(tm)_XP_1500+ PLD Linux Approved -- want me to check it in for you? > Changelog: > 2004-01-02 Pawel Ostrowski > > * tracepoint.c (validate_actionline): Fix segv at EOF > > > And the patch: > > *** gdb-6.0-orig/gdb/tracepoint.c Thu Jun 12 01:29:48 2003 > --- gdb-6.0/gdb/tracepoint.c Fri Jan 2 02:11:58 2004 > *************** validate_actionline (char **line, struct > *** 914,919 **** > --- 914,923 ---- > struct cleanup *old_chain = NULL; > char *p; > > + /* if EOF is typed, *line is NULL */ > + if (*line == NULL) > + return END; > + > for (p = *line; isspace ((int) *p);) > p++; > > > -- > Pasza >