Valgrind pointed out another little case where uninitialized data may be
used:

==7742== Conditional jump or move depends on uninitialised value(s)
==7742==    at 0x3DF2E2109C: _XUpdateGCCache (in /usr/lib64/libX11.so.6.3.0)
==7742==    by 0x3DF2E1E8BD: XChangeGC (in /usr/lib64/libX11.so.6.3.0)
==7742==    by 0x3BD0262869: ??? (in /usr/lib64/libgdk-x11-2.0.so.0.2000.1)
==7742==    by 0x3BD022786B: gdk_gc_set_foreground (in 
/usr/lib64/libgdk-x11-2.0.so.0.2000.1)
==7742==    by 0x3BD022792E: gdk_gc_set_rgb_fg_color (in 
/usr/lib64/libgdk-x11-2.0.so.0.2000.1)
==7742==    by 0x42B391: vik_viewport_new_gc (vikviewport.c:236)
==7742==    by 0x42B5A1: vik_viewport_configure (vikviewport.c:293)
...
==7742==  Uninitialised value was created by a stack allocation
==7742==    at 0x42B340: vik_viewport_new_gc (vikviewport.c:230)


I'm pretty sure this happens because of this code:

vik_viewport_configure()
{
...
  vvp->background_gc = vik_viewport_new_gc ( vvp, "", 1 );


GdkGC *vik_viewport_new_gc ( ..., const gchar *colorname, ... )
{
  GdkGC *rv;
  GdkColor color;

  rv = gdk_gc_new ( GTK_WIDGET(vvp)->window );
  gdk_color_parse ( colorname, &color );
  gdk_gc_set_rgb_fg_color ( rv, &color );


What happens is that the lookup of the color named "" fails so
gdk_color_parse() returns FALSE and fails to initialize the 'color'
variable which then gets used later on to set the foreground color.

There are perhaps two issues here, first it isn't clear what colour is
being requested for "" and second the code could either pre-initialize
color or set it to something sensible if the lookup fails.

   Jon



------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/

Reply via email to