Re: gdk breakage causing memory corruption




Mark Spencer <markster@marko.net> writes:

> After hours of trying to discover a bug that was causing cheops to crash
> on gtk 1.1.9, I finally had the bright idea of linking with -lefence, and
> after about a half hour of waiting for the application to run (it was
> really slow with efence), it finally broke here:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x402db503 in gdk_wcstombs (src=0x43bd6fc8) at gdkim.c:1494
> 1494            mbstr[i] = src[i];
> (gdb)
> 
> I've looked at the file and can't see anything really invalid with the
> logic, but it definitely crashes here, and when running without -lefence,
> it causes memory corruption in some importnat linked lists in my
> application.  Cheops runs fine on gtk 1.0.6

Sort of. The patch below should fix the problem that
efence is catching, but it is a "harmless"
out of bounds read, so I don't think it is causing the
list corruption.
 
> Anybody know what the cause of this problem is, and whether it's going to
> be fixed by the next gtk release?
> 
> Also, the following fails, incidently:
> 
> GtkWidget *label, *pane, *notebook
> 
> notebook = gtk_notebook_new();
> label = gtk_label_new("blah");
> pane = gtk_whatever_new();
> gtk_widget_show(label);
> gtk_widget_show(notebook);
> 
> 
> gtk_notebook_set_tabs(notebook, FALSE);
> gtk_notebook_add(notebook, pane);
> 
> then, when it actually goes to draw, gtklabel complains about wc_words !=
> NULL fails.  Instead, I have to add the stuff, realize the widget, then
> hide the tabs.
> 
> Mark

Are you reporting these bugs against the latest GTK+ in CVS?
Leaving aside the fact there never was a wc_words, the
warning I think you are reporting has been gone for
about a week. (I.e., no longer present in the source code)

Regards,
                                        Owen

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.875
diff -u -r1.875 ChangeLog
--- ChangeLog	1998/12/24 19:38:50	1.875
+++ ChangeLog	1998/12/29 21:00:11
@@ -1,3 +1,8 @@
+1998-12-29  Owen Taylor  <otaylor@srv-19-29.roc.ny.frontiernet.net>
+
+	* gdk/gdkim.c (gdk_wcstombs): Fixed off-by-one
+	error when computing length.
+
 Thu Dec 24 14:35:48 1998  Jeff Garzik  <jgarzik@pobox.com>
 
 	* gdk/gdkevents.c, gdk/gdkim.c, gdk/gdkrgb.c, gdk/gdkwindow.c,
Index: gdk/gdkim.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkim.c,v
retrieving revision 1.8
diff -u -r1.8 gdkim.c
--- gdkim.c	1998/12/24 19:38:55	1.8
+++ gdkim.c	1998/12/29 21:00:19
@@ -1493,8 +1493,8 @@
       gint length = 0;
       gint i;
 
-      while (src[length++] != 0)
-	;
+      while (src[length] != 0)
+	length++;
       
       mbstr = g_new (gchar, length + 1);
 





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]