From ef7ce0c0b57aa817095bdbeedaab7995810c4e8f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 29 Mar 2007 22:25:11 +0100 Subject: [PATCH] Intialize pixel to zero before AllocColor() ==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== AllocColor() may use the incoming pixel value as a guide, so it must be set to an appropiate value before calling. --- render/miindex.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/render/miindex.c b/render/miindex.c index 0e12dca..4e0cf00 100644 --- a/render/miindex.c +++ b/render/miindex.c @@ -147,6 +147,7 @@ miBuildRenderColormap (ColormapPtr pColormap, Pixel *pixels, int *nump) 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, int *nump) } 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; -- 1.4.4.2