[gs-commits] rev 12253 - trunk/ghostpdl/pcl

robin at ghostscript.com robin at ghostscript.com
Mon Mar 7 21:06:56 UTC 2011


Author: robin
Date: 2011-03-07 21:06:56 +0000 (Mon, 07 Mar 2011)
New Revision: 12253

Modified:
   trunk/ghostpdl/pcl/pcindxed.c
Log:
The PCL code creates an indexed colored space (with 256*3) entries, and then
only initialises the first few (typically 8*3). This leaves the rest undefined.
While this may not strictly be a bug, it certainly makes valgrind throw a fit,
and is really unhelpful when trying to track down other issues.

This commit forces the entries to be initialised to 0. This may possibly help
with the current indeterminisms - if it does, we should seek to understand
why. If it doesn't we can disable this code in a few days time (after
discussion with Henry when he returns).

Cluster results unknown; probably no change, but maybe some indetermisms
fixed.



Modified: trunk/ghostpdl/pcl/pcindxed.c
===================================================================
--- trunk/ghostpdl/pcl/pcindxed.c	2011-03-07 18:58:08 UTC (rev 12252)
+++ trunk/ghostpdl/pcl/pcindxed.c	2011-03-07 21:06:56 UTC (rev 12253)
@@ -134,6 +134,19 @@
     pindexed->palette.data = bp;
     pindexed->palette.size = 3 * pcl_cs_indexed_palette_size;
 
+    /* RJW: Set the contents of the palette to a known value. This is
+     * important to avoid valgrind warnings later on. The calling code may
+     * choose to only initialise the first (say) 8 entries of a 256 entry
+     * palette. This then causes valgrind to throw a fit when the whole 256
+     * entry palette is passed into cmsDoTransform later.
+     * An alternative solution would be to actualy set pindexed->palette.size
+     * correctly. An example of this is seen with the following invocation:
+     *     valgrind --track-origins=yes --db-attach=yes main/obj/pcl6 -r75
+     *       -dMaxBitmap=10000 -sDEVICE=pbmraw -o out.pbm
+     *       ../ghostpcl/tests_private/pcl/pcl5cats/Subset/AC7Z5SCC.BIN
+     */
+    memset(bp, 0, 3*pcl_cs_indexed_palette_size);
+
     code = gs_cspace_build_Indexed( &(pindexed->pcspace),
                                     pbase->pcspace,
                                     pcl_cs_indexed_palette_size,



More information about the gs-commits mailing list