[gs-cvs] rev 7490 - trunk/gs/src

lpd at ghostscript.com lpd at ghostscript.com
Sun Dec 10 20:48:55 PST 2006


Author: lpd
Date: 2006-12-10 20:48:55 -0800 (Sun, 10 Dec 2006)
New Revision: 7490

Modified:
   trunk/gs/src/spdiffx.h
   trunk/gs/src/spngpx.h
   trunk/gs/src/zfdecode.c
Log:
Raises the maximum value of Colors for PNG and PDiff filters from 16 to 60,
to prevent rangechecks in some PS3 CET 23-12{L,M,N,O,P}.


Modified: trunk/gs/src/spdiffx.h
===================================================================
--- trunk/gs/src/spdiffx.h	2006-12-11 01:28:57 UTC (rev 7489)
+++ trunk/gs/src/spdiffx.h	2006-12-11 04:48:55 UTC (rev 7490)
@@ -21,8 +21,9 @@
 /*
  * Define the maximum value for Colors.  This must be at least 4, but can
  * be arbitrarily large: the only cost is a larger stream state structure.
+ * Some PS3 CET files require this to be at least 57.
  */
-#define s_PDiff_max_Colors 16
+#define s_PDiff_max_Colors 60
 
 /* PixelDifferenceDecode / PixelDifferenceEncode */
 typedef struct stream_PDiff_state_s {

Modified: trunk/gs/src/spngpx.h
===================================================================
--- trunk/gs/src/spngpx.h	2006-12-11 01:28:57 UTC (rev 7489)
+++ trunk/gs/src/spngpx.h	2006-12-11 04:48:55 UTC (rev 7490)
@@ -18,11 +18,18 @@
 #ifndef spngpx_INCLUDED
 #  define spngpx_INCLUDED
 
+/*
+ * Define the maximum value for Colors.  The PNG specification probably
+ * defines this as 16, but some PS3 CET files require it to be as large as
+ * 53.  The only cost of larger values is a larger stream state structure.
+ */
+#define s_PNG_max_Colors 60
+
 /* PNGPredictorDecode / PNGPredictorEncode */
 typedef struct stream_PNGP_state_s {
     stream_state_common;
     /* The client sets the following before initialization. */
-    int Colors;			/* # of colors, 1..16 */
+    int Colors;			/* # of colors, 1..s_PNG_max_Colors */
     int BitsPerComponent;	/* 1, 2, 4, 8, 16 */
     uint Columns;		/* >0 */
     int Predictor;		/* 10-15, only relevant for Encode */
@@ -35,7 +42,7 @@
 				/* set dynamically when decoding */
     /* The following are updated dynamically. */
     long row_left;		/* # of bytes left in row */
-    byte prev[32];		/* previous samples */
+    byte prev[2 * s_PNG_max_Colors]; /* previous samples */
 } stream_PNGP_state;
 
 #define private_st_PNGP_state()	/* in sPNGP.c */\

Modified: trunk/gs/src/zfdecode.c
===================================================================
--- trunk/gs/src/zfdecode.c	2006-12-11 01:28:57 UTC (rev 7489)
+++ trunk/gs/src/zfdecode.c	2006-12-11 04:48:55 UTC (rev 7490)
@@ -292,7 +292,7 @@
 
     check_type(*op, t_dictionary);
     check_dict_read(*op);
-    if ((code = dict_int_param(op, "Colors", 1, 16, 1,
+    if ((code = dict_int_param(op, "Colors", 1, s_PNG_max_Colors, 1,
 			       &ppps->Colors)) < 0 ||
 	(code = dict_int_param(op, "BitsPerComponent", 1, 16, 8,
 			       &bpc)) < 0 ||



More information about the gs-cvs mailing list