Bug 10463 - miInitIndex(): Conditional jump or move depends on uninitialised value(s)
Summary: miInitIndex(): Conditional jump or move depends on uninitialised value(s)
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: * Other (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: xorg-7.4
  Show dependency treegraph
 
Reported: 2007-03-29 13:14 UTC by Chris Wilson
Modified: 2008-02-29 13:41 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Intialize pixel to zero before AllocColor (1.69 KB, patch)
2007-03-29 13:51 UTC, Chris Wilson
no flags Details | Splinter Review

Description Chris Wilson 2007-03-29 13:14:10 UTC
valgrinding Xvfb warns about:
==14535== Conditional jump or move depends on uninitialised value(s)
==14535==    at 0x806374C: FindColor (colormap.c:1226)
==14535==    by 0x8065888: AllocColor (colormap.c:912)
==14535==    by 0x831BFE0: miInitIndexed (miindex.c:153)
==14535==    by 0x831170F: PictureInitIndexedFormats (picture.c:485)
==14535==    by 0x8311781: PictureFinishInit (picture.c:502)
==14535==    by 0x8318E98: RenderExtensionInit (render.c:248)
==14535==    by 0x8061A74: InitExtensions (miinitext.c:646)
==14535==    by 0x808180E: main (main.c:379)
==14535== 

The fix is trivial:
--- a/render/miindex.c
+++ b/render/miindex.c
@@ -147,6 +147,7 @@ miBuildRenderColormap (ColormapPtr  pColormap, Pixel *pixels
        for (g = 0; g < cube; g++)
            for (b = 0; b < cube; b++)
            {
+               pixel = 0;
                red = (r * 65535 + (cube-1)/2) / (cube - 1);
                green = (g * 65535 + (cube-1)/2) / (cube - 1);
                blue = (b * 65535 + (cube-1)/2) / (cube - 1);
@@ -157,6 +158,7 @@ miBuildRenderColormap (ColormapPtr  pColormap, Pixel *pixels
            }
     for (g = 0; g < gray; g++)
     {
+       pixel = 0;
        red = green = blue = (g * 65535 + (gray-1)/2) / (gray - 1);
        if (AllocColor (pColormap, &red, &green, &blue, &pixel, 0) != Success)
            return FALSE;
Comment 1 Chris Wilson 2007-03-29 13:51:53 UTC
Created attachment 9362 [details] [review]
Intialize pixel to zero before AllocColor
Comment 2 Adam Jackson 2008-02-29 13:41:09 UTC
Fixed in git, thanks!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.