bug in gdk_gc_new_with_values



Illustration:

	... GtkWidget c; .... /* created elsewhere */
	... GtkStyle style; ... /* set up elsewhere */

       GdkGC *style_gc;
       GdkGC *new_gc;
       GdkGCValues style_values;

       style_gc = GTK_WIDGET(c)->style;
       gdk_gc_get_values (style->fg_gc[state], &style_values);
       new_gc = gdk_gc_new_with_values (GTK_WIDGET(c)->window,
                                        &style_values, ~0);		
       
 
This will segfault, because gdk_gc_new_with_values() checks the value
mask for GDK_GC_TILE, which is set, and then proceeds to indirect into
style_values.tile regardless of whether or not style_values.tile is set.

Granted, the ~0 should really be replaced by an OR of all possible
enums, but this won't rid of the bug. 

I would enclose a patch, but I'm not sure how many similar cases like
this exist. Its looks to me as though similar issues exist for
clip_mask and stipple.

--p



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