CW: Do not write beyond end of color table in X11DRV_DIB_SetDIBColorTable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

This is a part of the big CodeWeavers' patch.

Changelog:
    Dmitry Timoshkov <dmitry@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] );





[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux