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

alexcher at ghostscript.com alexcher at ghostscript.com
Mon Nov 6 04:33:12 PST 2006


Author: alexcher
Date: 2006-11-06 04:33:12 -0800 (Mon, 06 Nov 2006)
New Revision: 7165

Modified:
   trunk/gs/lib/gs_fonts.ps
   trunk/gs/lib/gs_res.ps
   trunk/gs/src/zbfont.c
Log:
Partialy fix CET 13-05:
- Trap errors in definefont procedure and re-throw them as definefont errors.
- Throw "invalidaccess in definefont" error for the no-access font dictionary
  instead of invalidfont that happens without the check. 
- Silently ignore invalid /FID attribute.

DIFFERENCES:
None


Modified: trunk/gs/lib/gs_fonts.ps
===================================================================
--- trunk/gs/lib/gs_fonts.ps	2006-11-05 04:14:18 UTC (rev 7164)
+++ trunk/gs/lib/gs_fonts.ps	2006-11-06 12:33:12 UTC (rev 7165)
@@ -485,7 +485,10 @@
   } stopped { $error /command get /invalidfont signalerror } if
 } bind def
 /definefont
- { /definefont cvx {.completefont} .errorexec
+ { dup rcheck not {
+      /definefont cvx /invalidaccess signalerror
+   } if
+   /definefont cvx {.completefont} .errorexec
                 % If the current allocation mode is global, also enter
                 % the font in LocalFontDirectory.
    .currentglobal

Modified: trunk/gs/lib/gs_res.ps
===================================================================
--- trunk/gs/lib/gs_res.ps	2006-11-05 04:14:18 UTC (rev 7164)
+++ trunk/gs/lib/gs_res.ps	2006-11-06 12:33:12 UTC (rev 7165)
@@ -981,7 +981,9 @@
   /.origfindfont /findfont load def
 end
 /definefont {
-  /Font defineresource
+  { /Font defineresource } stopped {
+      /definefont cvx $error /errorname get signalerror
+  } if
 } bind odef
 /undefinefont {
   /Font undefineresource

Modified: trunk/gs/src/zbfont.c
===================================================================
--- trunk/gs/src/zbfont.c	2006-11-05 04:14:18 UTC (rev 7164)
+++ trunk/gs/src/zbfont.c	2006-11-06 12:33:12 UTC (rev 7165)
@@ -644,9 +644,7 @@
 	)
 	return code;
     code = dict_find_string(op, "FID", &pfid);
-    if (code > 0) {
-	if (!r_has_type(pfid, t_fontID))
-	    return_error(e_invalidfont);
+    if (code > 0 && r_has_type(pfid, t_fontID)) { /* silently ignore invalid FID per CET 13-05.ps */
 	/*
 	 * If this font has a FID entry already, it might be a scaled font
 	 * made by makefont or scalefont; in a Level 2 environment, it might



More information about the gs-cvs mailing list