[gs-commits] rev 11604 - trunk/gs/cups

till at ghostscript.com till at ghostscript.com
Thu Aug 5 23:26:12 UTC 2010


Author: till
Date: 2010-08-05 23:26:12 +0000 (Thu, 05 Aug 2010)
New Revision: 11604

Modified:
   trunk/gs/cups/gdevcups.c
Log:
CUPS Raster output device: Segmentation fault on mid-job changes of the color depth.

This patch prevents the crash by forcing a memory reallocation on
color depth changes. The approach principally works but we did not
decide yet whether it is the final solution, as Michael Vrhel is still
doing major changes in the color handling. Bug 690435.



Modified: trunk/gs/cups/gdevcups.c
===================================================================
--- trunk/gs/cups/gdevcups.c	2010-08-05 19:16:11 UTC (rev 11603)
+++ trunk/gs/cups/gdevcups.c	2010-08-05 23:26:12 UTC (rev 11604)
@@ -3340,8 +3340,17 @@
     * does not keep track of the margins in the bitmap size...
     */
 
+    /* We set the old dimensions to -1 if we have a color depth change, so
+       that memory reallocation gets forced. This is perhaps not the correct
+       approach to preven crashes like in bug 690435. We keep it for the
+       time being until we decide finally */
+    if (color_set) {
+      width_old = -1;
+      height_old = -1;
+    } else {
     width_old = pdev->width;
     height_old = pdev->height;
+    }
     if (cups->landscape)
     {
       width  = (pdev->MediaSize[1] - pdev->HWMargins[1] - pdev->HWMargins[3]) *



More information about the gs-commits mailing list