From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24180 invoked by alias); 19 Nov 2004 01:02:53 -0000 Mailing-List: contact rda-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: rda-owner@sources.redhat.com Received: (qmail 23766 invoked from network); 19 Nov 2004 01:02:46 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 19 Nov 2004 01:02:46 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id iAJ12k51000410 for ; Thu, 18 Nov 2004 20:02:46 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id iAJ12kr22297 for ; Thu, 18 Nov 2004 20:02:46 -0500 Received: from localhost.localdomain (vpn50-61.rdu.redhat.com [172.16.50.61]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id iAJ12jbs023820 for ; Thu, 18 Nov 2004 20:02:46 -0500 Received: from saguaro (saguaro.lan [192.168.64.2]) by localhost.localdomain (8.12.11/8.12.10) with SMTP id iAJ12evq029262 for ; Thu, 18 Nov 2004 18:02:40 -0700 Date: Fri, 19 Nov 2004 01:02:00 -0000 From: Kevin Buettner To: rda@sources.redhat.com Subject: [PATCH] thread-db.c: Avoid segfault by making sure that ``reg'' is initialized Message-Id: <20041118180240.69493a51@saguaro> Organization: Red Hat X-Mailer: Sylpheed version 0.9.8claws30 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2004-q4/txt/msg00029.txt.bz2 [Hopefully, this'll end up in the right list this time...] I've just committed the patch below. As indicated by the subject line, this patch prevents a segfault when thread_db_set_thread_reg() returns an uninitialized ``reg''. (This was happening on Fedora Core 2 due to lack of xregset support.) * thread-db.c (thread_db_set_thread_reg): Don't allow a successful return without first initializing ``reg''. Index: thread-db.c =================================================================== RCS file: /cvs/src/src/rda/unix/thread-db.c,v retrieving revision 1.9 diff -u -p -r1.9 thread-db.c --- thread-db.c 20 Oct 2004 19:28:02 -0000 1.9 +++ thread-db.c 18 Nov 2004 21:39:21 -0000 @@ -2117,6 +2117,10 @@ thread_db_set_thread_reg (struct gdbserv GREGSET_T gregset; td_err_e ret; + /* Initialize reg to 0 in the event that we return early due to a + register being unsupported. */ + gdbserv_ulonglong_to_reg (serv, 0LL, reg); + if (thread == NULL) thread = process->event_thread; /* Default to the event thread. */