[gs-commits] rev 10905 - trunk/gs/base

ray at ghostscript.com ray at ghostscript.com
Wed Mar 10 05:20:00 UTC 2010


Author: ray
Date: 2010-03-10 05:19:59 +0000 (Wed, 10 Mar 2010)
New Revision: 10905

Modified:
   trunk/gs/base/gdevdevn.c
Log:
Fix for SEGV with the psdcmyk device on 258-01.ps. This was a fundamental memory
problem with any device that used the compressed_color_list functions in gdevdevn.c
since a 'restore' could free structures which were still needed by the device.
Use stable_memory to avoid this. Bug 691150.


Modified: trunk/gs/base/gdevdevn.c
===================================================================
--- trunk/gs/base/gdevdevn.c	2010-03-10 05:06:48 UTC (rev 10904)
+++ trunk/gs/base/gdevdevn.c	2010-03-10 05:19:59 UTC (rev 10905)
@@ -1194,11 +1194,12 @@
 
     /*
      * We keep a list of which colorant combinations we have used.  Make
-     * sure that this list has been initialized.
+     * sure that this list has been initialized. Alloc in stable_memory
+     * to make it immune to restore.
      */
     if (pdevn_params->compressed_color_list == NULL) {
         pdevn_params->compressed_color_list =
-		init_compressed_color_list(pdev->memory);
+		init_compressed_color_list(pdev->memory->stable_memory);
         if (pdevn_params->compressed_color_list == NULL)
 	    return NON_ENCODEABLE_COLOR;	/* Unable to initialize list */
     }
@@ -1214,11 +1215,13 @@
 
     /*
      * If our new colorant list was not found then add it to our encode color
-     * list.
+     * list. This needs to be in stable_memory to be immune to 'restore'.
      */
     if (!found) {
-	added = add_compressed_color_list(pdev->memory, &new_comp_bit_map,
-				pdevn_params->compressed_color_list, &list_index);
+	added = add_compressed_color_list(pdev->memory->stable_memory,
+					&new_comp_bit_map,
+					pdevn_params->compressed_color_list,
+					&list_index);
 	if (!added)
 	    return NON_ENCODEABLE_COLOR;
 	pbit_map = &new_comp_bit_map;



More information about the gs-commits mailing list