This is the mail archive of the rda@sources.redhat.com mailing list for the rda project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] thread-db.c: Avoid segfault by making sure that ``reg'' isinitialized


[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. */
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]