[gs-cvs] rev 7738 - in trunk/gs: doc lib src

alexcher at ghostscript.com alexcher at ghostscript.com
Fri Feb 23 14:05:38 PST 2007


Author: alexcher
Date: 2007-02-23 14:05:37 -0800 (Fri, 23 Feb 2007)
New Revision: 7738

Modified:
   trunk/gs/doc/pscet_status.txt
   trunk/gs/lib/gs_lev2.ps
   trunk/gs/lib/pdf_ops.ps
   trunk/gs/src/zpcolor.c
Log:
Use stricter validation of the pattern dictionary parameters to
match CET 18-02c and 18-02d.

DETAILS:
In particular, don't accept the degenerative matrix, unnormalized, or empty
bounding box. The difference in the operand stack in CET 18-02c is not yet
fixed. Adobe doesn't restore operands of rectfill operator when an error
happen in the PaintProc procedure but Ghostscript does.

DIFFERENCES:
No other CET differences, no comparefiles differences.


Modified: trunk/gs/doc/pscet_status.txt
===================================================================
--- trunk/gs/doc/pscet_status.txt	2007-02-23 18:32:39 UTC (rev 7737)
+++ trunk/gs/doc/pscet_status.txt	2007-02-23 22:05:37 UTC (rev 7738)
@@ -3692,11 +3692,12 @@
 18-02B-9  AOK	18-02A-4 repeat
 	Fill rule is ok, shadings sharper in GS than Adobe. - Raph
 
-18-02C-1  DIFF	rangecheck vs. typecheck.
-                undefined in cpsi not in GS. assign: Alex
+18-02C-1  DIFF	Partialy fixed by rev. 7738.
+                Adobe doesn't restore operands of rectfill operator when
+                an error happen in the PaintProc function but
+                Ghostscript does. assign: Alex
 
-18-02D-1  DIFF	GS missing text. GS has different error messages.
-                GS printing extra pattern mid-page. assign Alex
+18-02D-1  OK  	Fixed by rev. 7738. - Alex
 
 18-02E-1  DIFF	much of postscript dump missing in gs. assign Ray
 

Modified: trunk/gs/lib/gs_lev2.ps
===================================================================
--- trunk/gs/lib/gs_lev2.ps	2007-02-23 18:32:39 UTC (rev 7737)
+++ trunk/gs/lib/gs_lev2.ps	2007-02-23 22:05:37 UTC (rev 7738)
@@ -852,7 +852,13 @@
 def
 
 /makepattern {			% <proto_dict> <matrix> makepattern <pattern>
-  //.patterntypes 2 .argindex /PatternType get get
+  dup type /dicttype eq {
+     % "<dict> makepattern" reports /typecheck on Adobe
+     /makepattern .systemvar /typecheck signalerror
+  } if
+  //.patterntypes 2 .argindex /PatternType get .knownget not {
+      /makepattern .systemvar /rangecheck signalerror
+  } if
   .currentglobal false .setglobal exch
 		% Stack: proto matrix global buildproc
   3 index dup length 1 add dict .copydict

Modified: trunk/gs/lib/pdf_ops.ps
===================================================================
--- trunk/gs/lib/pdf_ops.ps	2007-02-23 18:32:39 UTC (rev 7737)
+++ trunk/gs/lib/pdf_ops.ps	2007-02-23 22:05:37 UTC (rev 7738)
@@ -152,8 +152,8 @@
 /csdevcmyk [/DeviceCMYK] readonly def
 /cspattern [/Pattern] readonly def
 /nullpattern1 mark
-   /PatternType 1 /PaintType 1 /TilingType 3 /BBox [0 0 0 0]
-   /XStep 1 /YStep 1 /PaintProc { }
+   /PatternType 1 /PaintType 1 /TilingType 3 /BBox [0 0 1 1]
+   /XStep 1 /YStep 1 /PaintProc { pop } bind
 .dicttomark readonly def
 /nullpattern2 nullpattern1 dup length dict copy readonly def
 

Modified: trunk/gs/src/zpcolor.c
===================================================================
--- trunk/gs/src/zpcolor.c	2007-02-23 18:32:39 UTC (rev 7737)
+++ trunk/gs/src/zpcolor.c	2007-02-23 22:05:37 UTC (rev 7738)
@@ -89,20 +89,58 @@
     gs_client_color cc_instance;
     ref *pPaintProc;
 
+    code = read_matrix(imemory, op, &mat);
+    if (code < 0)
+        return code;
     check_type(*op1, t_dictionary);
     check_dict_read(*op1);
     gs_pattern1_init(&template);
-    if ((code = read_matrix(imemory, op, &mat)) < 0 ||
-	(code = dict_uid_param(op1, &template.uid, 1, imemory, i_ctx_p)) != 1 ||
-	(code = dict_int_param(op1, "PaintType", 1, 2, 0, &template.PaintType)) < 0 ||
-	(code = dict_int_param(op1, "TilingType", 1, 3, 0, &template.TilingType)) < 0 ||
-	(code = dict_floats_param(imemory, op1, "BBox", 4, BBox, NULL)) < 0 ||
-	(code = dict_float_param(op1, "XStep", 0.0, &template.XStep)) != 0 ||
-	(code = dict_float_param(op1, "YStep", 0.0, &template.YStep)) != 0 ||
-	(code = dict_find_string(op1, "PaintProc", &pPaintProc)) <= 0
-	)
-	return_error((code < 0 ? code : e_rangecheck));
+
+    code = dict_uid_param(op1, &template.uid, 1, imemory, i_ctx_p);
+    if (code < 0)
+        return code;
+    if (code != 1)
+        return_error(e_rangecheck);
+
+    code = dict_int_param(op1, "PaintType", 1, 2, 0, &template.PaintType);
+    if (code < 0)
+        return code;
+
+    code = dict_int_param(op1, "TilingType", 1, 3, 0, &template.TilingType);
+    if (code < 0)
+        return code;
+    
+    code = dict_floats_param(imemory, op1, "BBox", 4, BBox, NULL);
+    if (code < 0)
+        return code;
+    if (code == 0)
+       return_error(e_undefined); 
+
+    code = dict_float_param(op1, "XStep", 0.0, &template.XStep);
+    if (code < 0)
+        return code;
+    if (code == 1)
+       return_error(e_undefined); 
+    
+    code = dict_float_param(op1, "YStep", 0.0, &template.YStep);
+    if (code < 0)
+        return code;
+    if (code == 1)
+       return_error(e_undefined); 
+    
+    code = dict_find_string(op1, "PaintProc", &pPaintProc);
+    if (code < 0)
+        return code;
+    if (code == 0)
+       return_error(e_undefined); 
+
     check_proc(*pPaintProc);
+
+    if (mat.xx * mat.yy == mat.xy * mat.yx)
+        return_error(e_undefinedresult);
+    if (BBox[0] >= BBox[2] ||  BBox[1] >= BBox[3])
+        return_error(e_rangecheck);
+
     template.BBox.p.x = BBox[0];
     template.BBox.p.y = BBox[1];
     template.BBox.q.x = BBox[2];



More information about the gs-cvs mailing list