CW: Do not write beyond end of color table in X11DRV_DIB_SetDIBColorTable
Dmitry Timoshkov
dmitry at baikal.ru
Sun Jan 27 05:12:37 CST 2002
Hello.
This is a part of the big CodeWeavers' patch.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Do not write beyond end of color table in X11DRV_DIB_SetDIBColorTable.
--- cvs/wine/graphics/x11drv/dib.c Sun Jan 06 07:25:50 2002
+++ wine/graphics/x11drv/dib.c Sun Jan 27 10:51:50 2002
@@ -5832,6 +5832,8 @@
X11DRV_DIBSECTION *dib = (X11DRV_DIBSECTION *) bmp->dib;
if (dib && dib->colorMap) {
+ UINT end = count + start;
+ if (end > dib->nColorMap) end = dib->nColorMap;
/*
* Changing color table might change the mapping between
* DIB colors and X11 colors and thus alter the visible state
@@ -5840,9 +5842,9 @@
X11DRV_DIB_Lock(bmp, DIB_Status_AppMod, FALSE);
X11DRV_DIB_GenColorMap( dc, dib->colorMap, DIB_RGB_COLORS,
dib->dibSection.dsBm.bmBitsPixel,
- TRUE, colors, start, count + start );
+ TRUE, colors, start, end );
X11DRV_DIB_Unlock(bmp, TRUE);
- return count;
+ return end - start;
}
return 0;
}
@@ -5855,7 +5857,7 @@
X11DRV_DIBSECTION *dib = (X11DRV_DIBSECTION *) bmp->dib;
if (dib && dib->colorMap) {
- int i, end = count + start;
+ UINT i, end = count + start;
if (end > dib->nColorMap) end = dib->nColorMap;
for (i = start; i < end; i++,colors++) {
COLORREF col = X11DRV_PALETTE_ToLogical( dib->colorMap[i] );
More information about the wine-patches
mailing list