[gs-cvs] rev 7209 - trunk/gs/lib
alexcher at ghostscript.com
alexcher at ghostscript.com
Thu Nov 16 21:28:17 PST 2006
Author: alexcher
Date: 2006-11-16 21:28:16 -0800 (Thu, 16 Nov 2006)
New Revision: 7209
Modified:
trunk/gs/lib/gs_cspace.ps
trunk/gs/lib/gs_ll3.ps
Log:
Validate the argument of setcolorspace before trying to process it.
Catch errors from setcolorspace and re-throw them from shfill.
Fix CET 12-14d.
DIFFERENCES:
None
Modified: trunk/gs/lib/gs_cspace.ps
===================================================================
--- trunk/gs/lib/gs_cspace.ps 2006-11-16 16:45:12 UTC (rev 7208)
+++ trunk/gs/lib/gs_cspace.ps 2006-11-17 05:28:16 UTC (rev 7209)
@@ -467,7 +467,18 @@
%
/_setcolorspace
{
- { % See if the operand space is the same as the current space.
+ { % Early validation the argument. The code below fails in unpredictable ways
+ % when it is exposed to the garbage.
+ 1 index
+ dup type dup /arraytype eq exch /packedarraytype eq or { 0 get } if
+ dup type /nametype ne {
+ //.cspace_util /setcolorspace get /typecheck signalerror
+ } if
+ //colorspacedict exch known not {
+ //.cspace_util /setcolorspace get /undefined signalerror
+ } if
+
+ % See if the operand space is the same as the current space.
% The test is intentionaly conservative to meet CET 09-06.
1 index % [/new] bool [/new]
type /nametype eq
Modified: trunk/gs/lib/gs_ll3.ps
===================================================================
--- trunk/gs/lib/gs_ll3.ps 2006-11-16 16:45:12 UTC (rev 7208)
+++ trunk/gs/lib/gs_ll3.ps 2006-11-17 05:28:16 UTC (rev 7209)
@@ -271,7 +271,16 @@
/$error .systemvar /errorinfo [ /ShadingType 4 index ] put
/shfill .systemvar /rangecheck signalerror
} if
- exch pop 1 index /ColorSpace get setcolorspace exec
+ exch pop 1 index /ColorSpace .knownget {
+ { setcolorspace } stopped {
+ /$error .systemvar /errorinfo [ /ColorSpace 4 index ] put
+ /shfill .systemvar /$error .systemvar /errorname get signalerror
+ } if
+ exec
+ } {
+ /$error .systemvar /errorinfo [ /ColorSpace //null ] put
+ /shfill .systemvar /undefined signalerror
+ } ifelse
} bind def
systemdict /.reuseparamdict undef
More information about the gs-cvs
mailing list