Bug 10464

Summary: FakeAllocColor(): Conditional jump or move depends on uninitialised value(s)
Product: xorg Reporter: Chris Wilson <chris>
Component: * OtherAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: esigra
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 10101    
Attachments:
Description Flags
Set the pixel value to zero before commencing FindColor none

Description Chris Wilson 2007-03-29 13:30:22 UTC
==31523== Conditional jump or move depends on uninitialised value(s)
==31523==    at 0x80585DC: FindColor (colormap.c:1226)
==31523==    by 0x8058CDD: FakeAllocColor (colormap.c:1017)
==31523==    by 0x80D1EFA: miSpriteFindColors (misprite.c:548)
==31523==    by 0x80D226F: miSpriteSetCursor (misprite.c:661)
==31523==    by 0x80CA99A: miPointerUpdateSprite (mipointer.c:343)
==31523==    by 0x80CAAF4: miPointerDisplayCursor (mipointer.c:188)
==31523==    by 0x80E038D: CursorDisplayCursor (cursor.c:136)
==31523==    by 0x811EDC4: AnimCurDisplayCursor (animcur.c:234)
==31523==    by 0x806F18A: DefineInitialRootWindow (events.c:2118)
==31523==    by 0x8078C3C: main (main.c:451)

Trivial fix:
diff --git a/dix/colormap.c b/dix/colormap.c
index 73b6669..8836737 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -1013,6 +1013,7 @@ FakeAllocColor (ColormapPtr pmap, xColorItem *item)
     switch (class) {
     case GrayScale:
     case PseudoColor:
+       temp = 0;
        item->pixel = 0;
        if (FindColor(pmap, pmap->red, entries, &rgb, &temp, PSEUDOMAP,
                      -1, AllComp) == Success) {
Comment 1 Chris Wilson 2007-03-29 13:52:49 UTC
Created attachment 9363 [details] [review]
Set the pixel value to zero before commencing FindColor
Comment 2 Adam Jackson 2008-02-29 13:42:34 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.