If depth < 3, one or more of {red,green,blue}Mask and lim[rgb] will be zero, causing division by zero errors. Add checks to avoid this.
Question: Should we restrict depth < 3 to grayscale visuals instead? For monochrome this is already needed, as miCreateDefColormap() only preallocates black and white pixels if depth > 1. Signed-off-by: Geert Uytterhoeven <ge...@linux-m68k.org> --- mi/micmap.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mi/micmap.c b/mi/micmap.c index 3ef0c8c..c02596b 100644 --- a/mi/micmap.c +++ b/mi/micmap.c @@ -138,13 +138,13 @@ miInitializeColormap(ColormapPtr pmap) limb = pVisual->blueMask >> pVisual->offsetBlue; for (i = 0; i <= maxent; i++) { /* rescale to [0..65535] then rgb bits */ - pmap->red[i].co.local.red = + pmap->red[i].co.local.red = !limr ? 0 : ((((((i & pVisual->redMask) >> pVisual->offsetRed) * 65535) / limr) >> shift) * 65535) / lim; - pmap->red[i].co.local.green = + pmap->red[i].co.local.green = !limg ? 0 : ((((((i & pVisual->greenMask) >> pVisual->offsetGreen) * 65535) / limg) >> shift) * 65535) / lim; - pmap->red[i].co.local.blue = + pmap->red[i].co.local.blue = !limb ? 0 : ((((((i & pVisual->blueMask) >> pVisual->offsetBlue) * 65535) / limb) >> shift) * 65535) / lim; } -- 1.7.0.4 -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/1364390451-9656-4-git-send-email-ge...@linux-m68k.org