From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31793 invoked by alias); 2 Jan 2004 02:12:39 -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 31761 invoked from network); 2 Jan 2004 02:12:31 -0000 Received: from unknown (HELO mail1.astercity.net) (212.76.33.23) by sources.redhat.com with SMTP; 2 Jan 2004 02:12:31 -0000 Received: from dixie.localdomain (52-tor-2.acn.waw.pl [62.121.69.52]) by mail1.astercity.net (sendmail) with ESMTP id EC3BCE1AD6 for ; Fri, 2 Jan 2004 03:12:30 +0100 (CET) Received: by dixie.localdomain (Postfix, from userid 500) id 3BA7B10E7C1; Fri, 2 Jan 2004 03:12:43 +0100 (CET) Date: Fri, 02 Jan 2004 02:12:00 -0000 From: Pawel Ostrowski To: gdb-patches@sources.redhat.com Subject: [PATCH] segv fix when eof is typed in actions Message-ID: <20040102021243.GA28939@dixie.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2004-01/txt/msg00011.txt.bz2 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 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