dib.c - random segfaults

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

 



Using my ImageList patch uncovered one more bug ;-)

Vitaliy Margolen

changelog:
  fix random segfaults in X11DRV_SetImageBits_1


Index: graphics/x11drv/dib.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/dib.c,v
retrieving revision 1.107
diff -u -r1.107 dib.c
--- graphics/x11drv/dib.c       18 Feb 2003 23:29:48 -0000      1.107
+++ graphics/x11drv/dib.c       30 Mar 2003 04:42:48 -0000
@@ -1628,16 +1628,18 @@
             XPutPixel( bmpImage, x++, h, colors[(srcval >> 1) & 1] );
             XPutPixel( bmpImage, x++, h, colors[ srcval       & 1] );
         }
-        srcval=*srcbyte;
-        switch (dstwidth & 7)
-        {
-        case 7: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]); srcval<<=1;
-        case 6: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]); srcval<<=1;
-        case 5: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]); srcval<<=1;
-        case 4: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]); srcval<<=1;
-        case 3: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]); srcval<<=1;
-        case 2: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]); srcval<<=1;
-        case 1: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]);
+        if (dstwidth % 8){
+            srcval=*srcbyte;
+            switch (dstwidth & 7)
+            {
+            case 7: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]); srcval<<=1;
+            case 6: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]); srcval<<=1;
+            case 5: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]); srcval<<=1;
+            case 4: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]); srcval<<=1;
+            case 3: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]); srcval<<=1;
+            case 2: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]); srcval<<=1;
+            case 1: XPutPixel(bmpImage, x++, h, colors[srcval >> 7]);
+            }
         }
         srcbits += linebytes;
     }



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

  Powered by Linux