summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2018-09-13 22:22:18 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2018-09-13 22:22:18 +0000
commit1f22db896cffa43de7438e479735b5cf994a0357 (patch)
treee33945a391e7729bbfbe4985770242503eafe43c /Master/tlpkg/tlgs/Resource/Init/gs_init.ps
parent834611c7675b1f0a1c01e98b273eb260a84c880f (diff)
Upgrade gs-9.23 -> gs-9.25
git-svn-id: svn://tug.org/texlive/trunk@48659 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlgs/Resource/Init/gs_init.ps')
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_init.ps371
1 files changed, 200 insertions, 171 deletions
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_init.ps b/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
index 6c8da532ca0..bec307d1b13 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_init.ps
@@ -29,7 +29,7 @@
% Interpreter library version number
% NOTE: the interpreter code requires that the first non-comment token
% in this file be an integer, and that it match the compiled-in version!
-923
+925
% Check the interpreter revision.
dup revision ne
@@ -767,23 +767,6 @@ userdict /.currentresourcefile //null put
{ /run .systemvar exec } .execasresource
} bind def
-% Define procedures for getting and setting the current device resolution.
-
-/gsgetdeviceprop % <device> <propname> gsgetdeviceprop <value>
- { 2 copy mark exch //null .dicttomark .getdeviceparams
- dup mark eq % if true, not found
- { pop dup /undefined signalerror }
- { 5 1 roll pop pop pop pop }
- ifelse
- } bind def
-/gscurrentresolution % - gscurrentresolution <[xres yres]>
- { currentdevice /HWResolution gsgetdeviceprop
- } bind def
-/gssetresolution % <[xres yres]> gssetresolution -
- { 2 array astore mark exch /HWResolution exch
- currentdevice copydevice putdeviceprops setdevice
- } bind def
-
% Define auxiliary procedures needed for the above.
/shellarguments % -> shell_arguments true (or) false
{ /ARGUMENTS where
@@ -898,7 +881,7 @@ userdict /.currentresourcefile //null put
{ not exch pop exit } { pop } ifelse
}
for exch pop .quit
- } bind def
+ } bind executeonly def
/.errorhandler % <command> <errorname> .errorhandler -
{ % Detect an internal 'stopped'.
1 .instopped { //null eq { pop pop stop } if } if
@@ -943,7 +926,7 @@ userdict /.currentresourcefile //null put
$error /globalmode get $error /.nosetlocal get and .setglobal
$error /.inerror //false put
stop
- } bind def
+ } bind executeonly def
% Define the standard handleerror. We break out the printing procedure
% (.printerror) so that it can be extended for binary output
% if the Level 2 facilities are present.
@@ -993,7 +976,7 @@ userdict /.currentresourcefile //null put
ifelse % newerror
end
flush
- } bind def
+ } bind executeonly def
/.printerror_long % long error printout,
% $error is on the dict stack
{ % Push the (anonymous) stack printing procedure.
@@ -1070,14 +1053,14 @@ userdict /.currentresourcefile //null put
{ (Current file position is ) print position = }
if
- } bind def
+ } bind executeonly def
% Define a procedure for clearing the error indication.
/.clearerror
{ $error /newerror //false put
$error /errorname //null put
$error /errorinfo //null put
0 .setoserrno
- } bind def
+ } bind executeonly def
% Define $error. This must be in local VM.
.currentglobal //false .setglobal
@@ -1103,11 +1086,15 @@ end
/errordict ErrorNames length 3 add dict
.forcedef % errordict is local, systemdict is global
.setglobal % back to global VM
-% For greater Adobe compatibility, we put all non-standard errors in a
-% separate dictionary, gserrordict. It does not need to be in local VM,
-% because PostScript programs do not access it.
+% gserrordict contains all the default error handling methods, but unlike
+% errordict it is noaccess after creation (also it is in global VM).
+% When running 'SAFER', we'll ignore the contents of errordict, which
+% may have been tampered with by the running job, and always use gserrordict
+% gserrordict also contains any non-standard errors, for better compatibility
+% with Adobe.
+%
% NOTE: the name gserrordict is known to the interpreter.
-/gserrordict 5 dict def
+/gserrordict ErrorNames length 3 add dict def
% Register an error in errordict. We make this a procedure because we only
% register the Level 1 errors here: the rest are registered by "feature"
% files. However, ErrorNames contains all of the error names regardless of
@@ -1136,8 +1123,11 @@ errordict begin
} bind def
end % errordict
-% Put non-standard errors in gserrordict.
-gserrordict /unknownerror errordict /unknownerror get put
+% Put all the default handlers in gserrordict
+gserrordict
+errordict {2 index 3 1 roll put} forall
+noaccess pop
+% remove the non-standard errors from errordict
errordict /unknownerror .undef
% Define a stable private copy of handleerror that we will always use under
% JOBSERVER mode.
@@ -1521,6 +1511,14 @@ setpacking
dup 150 lt //systemdict /DITHERPPI known not and
} bind def
+/.gsgetdeviceprop % <device> <propname> gsgetdeviceprop <value>
+ { 2 copy mark exch //null .dicttomark .getdeviceparams
+ dup mark eq % if true, not found
+ { pop dup /undefined signalerror }
+ { 5 1 roll pop pop pop pop }
+ ifelse
+ } bind def
+
% The following implementation uses LL2 extensions, but only in stopped
% contexts so that with LL1, the .set??reshalftone will be used.
%
@@ -1528,7 +1526,7 @@ setpacking
% false
/.getdefaulthalftone {
% try the device to see if it has a default halftone
- { currentdevice /HalftoneDefault gsgetdeviceprop } .internalstopped
+ { currentdevice /HalftoneDefault //.gsgetdeviceprop exec } .internalstopped
{ pop pop //false } % no device property
{ dup type /dicttype eq { //true } { pop //false } ifelse }
ifelse
@@ -1541,6 +1539,7 @@ setpacking
}
if
} bind def
+currentdict /.gsgetdeviceprop .forceundef
/.setdefaulthalftone {
.getdefaulthalftone
@@ -2012,15 +2011,30 @@ systemdict /EPSBoundingBoxInit known { EPSBoundingBoxInit } if
.currentglobal //true .setglobal
/SAFETY 2 dict
dup /safe //false put
- dup /tempfiles 10 dict readonly put
+ dup /tempfiles 10 dict noaccess put
readonly def
.setglobal
+/tempfilepaths
+[
+ (TMPDIR) getenv not
+ {
+ (TEMP) getenv not
+ {
+ (TMP) getenv not
+ {
+ (/temp) (/tmp)
+ } if
+ } if
+ } if
+] def
+
/.locksafe_userparams {
SAFETY /safe get not {
<<
/PermitFileReading [
currentuserparams /PermitFileReading get aload pop
+ //tempfilepaths (*) .generate_dir_list_templates
/FONTPATH .systemvar (*) .generate_dir_list_templates
% Library files :
/LIBPATH .systemvar (*) .generate_dir_list_templates
@@ -2035,6 +2049,18 @@ readonly def
[ currentsystemparams /GenericResourceDir get] (*) .file_name_separator (*)
concatstrings concatstrings .generate_dir_list_templates
} if
+ currentuserparams /ICCProfilesDir known {
+ [currentuserparams /ICCProfilesDir get] (*)
+ .generate_dir_list_templates
+ } if
+ ]
+ /PermitFileWriting [
+ currentuserparams /PermitFileWriting get aload pop
+ //tempfilepaths (*) .generate_dir_list_templates
+ ]
+ /PermitFileControl [
+ currentuserparams /PermitFileControl get aload pop
+ //tempfilepaths (*) .generate_dir_list_templates
]
/LockFilePermissions //true
>> setuserparams
@@ -2042,6 +2068,8 @@ readonly def
if
} bind def
+currentdict /tempfilepaths undef
+
/.locksafe {
.locksafe_userparams
systemdict /getenv {pop //false} .forceput
@@ -2103,151 +2131,145 @@ readonly def
.locksafeglobal
} bind executeonly odef
-/deletefile {
- dup { deletefile } stopped {
- pop //deletefile $error /errorname get signalerror
- } {
- % deletefile succeeded. Remove from tempfile list if present
- //SAFETY /tempfiles get exch cvn 2 copy known {
- .forceundef
- } {
- pop pop
- }
- ifelse
- }
- ifelse
-} .bind executeonly odef
-
-% If a file is opened with .tempfile with SAFER not (yet) set,
-% the file can be deleted later, even if SAFER is set.
-/.tempfile {
- .tempfile % filename file
- //SAFETY /tempfiles get 2 .argindex //true .forceput
-} .bind executeonly odef
-
% If we are running in SAFER mode, lock things down
SAFER { .setsafeglobal } if
+/SAFERUndefinePostScriptOperators {
+ [
+ % Used by our own test suite files
+ /.pushpdf14devicefilter % transparency-example.ps
+ /.poppdf14devicefilter % transparency-example.ps
+ /.setopacityalpha % transparency-example.ps
+ /.setshapealpha % transparency-example.ps
+ /.endtransparencygroup % transparency-example.ps
+ /.setdotlength % Bug687720.ps
+ /.sort /.setdebug /.mementolistnewblocks /getenv
+
+ /.makeoperator /.setCPSImode % gs_cet.ps, this won't work on cluster with -dSAFER
+
+ /unread
+ ]
+ {systemdict exch .forceundef} forall
+
+ //systemdict /SAFERUndefinePostScriptOperators .forceundef
+} .bind executeonly def % must be bound and hidden for .forceundef
+
/UndefinePostScriptOperators {
-%% This list is of Display PostScript operators. We believe that Display PostScript
-%% was never fully implemented and the only known user, GNUStep, is no longer
-%% using it. So lets remove it.
-[
-/condition /currentcontext /detach /.fork /join /.localfork /lock /monitor /notify
-/wait /yield /.currentscreenphase /.setscreenphase /.image2 /eoviewclip /initviewclip
-/viewclip /viewclippath /defineusername
-%% NeXT DPS extensions
-/currentalpha /setalpha /.alphaimage /composite /compositerect /dissolve /sizeimagebox /.sizeimageparams
-]
-{systemdict exch .forceundef} forall
-
-%% This list is of operators which no longer appear to be used, and which we do not believe
-%% to have any real use. For now we will undefine the operstors so they cannot easily be used
-%% but can be easily restored (just delete the name from the list in the array). In future
-%% we may remove the operator and the code implementation entirely.
-[
-/.bitadd /.charboxpath /.cond /.countexecstack /.execstack /.runandhide /.popdevicefilter
-/.execfile /.filenamesplit /.file_name_parent
-/.setdefaultmatrix /.isprocfilter /.unread /.psstringencode
-/.buildsampledfunction /.isencapfunction /.currentaccuratecurves /.currentcurvejoin /.currentdashadapt /.currentdotlength
-/.currentlimitclamp /.dotorientation /.setaccuratecurves /.setcurvejoin /.setdashadapt /.setdotorientation
-/.setlimitclamp /.currentscreenlevels /.dashpath /.pathbbox /.identeq /.identne /.tokenexec /.forgetsave /.pantonecallback
-
-%% Used by our own test suite files
-%%/.setdotlength % Bug687720.ps
-]
-{systemdict exch .forceundef} forall
-
-%% This list of operators are used internally by various parts of the Ghostscript startup code.
-%% Since each operator is a potential security vulnerability, and any operator listed here
-%% is not required once the initislisation is complete and functions are bound, we undefine
-%% the ones that aren't needed at runtime.
-[
-/.callinstall /.callbeginpage /.callendpage
-/.currentstackprotect /.setstackprotect /.errorexec /.finderrorobject /.installsystemnames /.bosobject /.fontbbox
-/.type1execchar /.type2execchar /.type42execchar /.setweightvector /.getuseciecolor /processcolors /.includecolorspace
-/.execn /.instopped /.stop /.stopped /.setcolorrendering /.setdevicecolorrendering /.buildcolorrendering1 /.builddevicecolorrendering1
-/.TransformPQR_scale_WB0 /.TransformPQR_scale_WB1 /.TransformPQR_scale_WB2 /.currentoverprintmode /.copydevice2
-/.devicename /.doneshowpage /.getbitsrect /.getdevice /.getdefaultdevice /.getdeviceparams /.gethardwareparams
-/makewordimagedevice /.outputpage /.putdeviceparams /.setdevice /.currentshowpagecount
-/.setpagedevice /.currentpagedevice /.knownundef /.setmaxlength /.rectappend /.initialize_dsc_parser /.parse_dsc_comments
-/.fillCIDMap /.fillIdentityCIDMap /.buildcmap /.filenamelistseparator /.libfile /.getfilename
-/.file_name_combine /.file_name_is_absolute /.file_name_separator /.file_name_directory_separator /.file_name_current /.filename
-/.peekstring /.writecvp /.subfiledecode /.setupUnicodeDecoder /.jbig2makeglobalctx /.registerfont /.parsecff
-/.getshowoperator /.getnativefonts /.beginform /.endform /.get_form_id /.repeatform /.reusablestream /.rsdparams
-/.buildfunction /.currentfilladjust2 /.setfilladjust2 /.sethpglpathmode /.currenthpglpathmode
-/.currenthalftone /.sethalftone5 /.image1 /.imagemask1 /.image3 /.image4
-/.getiodevice /.getdevparms /.putdevparams /.bbox_transform /.matchmedia /.matchpagesize /.defaultpapersize
-/.oserrno /.setoserrno /.oserrorstring /.getCPSImode
-/.getscanconverter /.setscanconverter /.type1encrypt /.type1decrypt/.languagelevel /.setlanguagelevel /.eqproc /.fillpage /.buildpattern1 /.saslprep
-/.buildshading1 /.buildshadin2 /.buildshading3 /.buildshading4 /.buildshading5 /.buildshading6 /.buildshading7 /.buildshadingpattern
-/.argindex /.bytestring /.namestring /.stringbreak /.stringmatch /.globalvmarray /.globalvmdict /.globalvmpackedarray /.globalvmstring
-/.localvmarray /.localvmdict /.localvmpackedarray /.localvmstring /.systemvmarray /.systemvmdict /.systemvmpackedarray /.systemvmstring /.systemvmfile /.systemvmlibfile
-/.systemvmSFD /.settrapparams /.currentsystemparams /.currentuserparams /.getsystemparam /.getuserparam /.setsystemparams /.setuserparams
-/.checkpassword /.locale_to_utf8 /.currentglobal /.gcheck /.imagepath
-
-% Used by a free user in the Library of Congress. Apparently this is used to
-% draw a partial page, which is then filled in by the results of a barcode
-% scanner and SQL database lookup. Its not clear to us exactly why this needs to be
-% done as a partial page, but its easiest to restore the operator, and it seems like
-% its a reasonably safe operator to restore, for the *very* few devices on which
-% it will have any effect. Currently this uses the 'sync_outptu' device method
-% to transfer the partial page, in future we may use a spec_op instead.
-%/flushpage
-
-% Used by our own test suite files
-%/.fileposition %image-qa.ps
-%/.makeoperator /.setCPSImode % gs_cet.ps
-
-% Either our code uses these in ways which mean they can't be undefined, or they are used directly by
-% test files/utilities, or engineers expressed a desire to keep them visible.
-%
-%/currentdevice /.sort /.buildfont0 /.buildfont1 /.buildfont2 /.buildfont3 /.buildfont4 /.buildfont9 /.buildfont10 /.buildfont11
-%/.buildfotn32 /.buildfont42 /.type9mapcid /.type11mapcid /.swapcolors
-%/currentdevice /.quit /.setuseciecolor /.needinput /.setoverprintmode /.special_op /.dicttomark /.knownget
-%/.FAPIavailable /.FAPIpassfont /.FAPIrebuildfont /.FAPIBuildGlyph /.FAPIBuildChar /.FAPIBuildGlyph9
-%/.tempfile /.numicc_components /.set_outputintent /.max /.min /.shfill /.vmreclaim /.getpath /.setglobal
-%/.setdebug /.mementolistnewblocks /getenv
-]
-{systemdict exch .forceundef} forall
-
-//systemdict /UndefinePostScriptOperators .forceundef
-} bind def
+ %% This list is of Display PostScript operators. We believe that Display PostScript
+ %% was never fully implemented and the only known user, GNUStep, is no longer
+ %% using it. So lets remove it.
+ [
+ /condition /currentcontext /detach /.fork /join /.localfork /lock /monitor /notify
+ /wait /yield /.currentscreenphase /.setscreenphase /.image2 /eoviewclip /initviewclip
+ /viewclip /viewclippath /defineusername
+ %% NeXT DPS extensions
+ /currentalpha /setalpha /.alphaimage /composite /compositerect /dissolve /sizeimagebox /.sizeimageparams
+ ]
+ {systemdict exch .forceundef} forall
+
+ %% This list is of operators which no longer appear to be used, and which we do not believe
+ %% to have any real use. For now we will undefine the operstors so they cannot easily be used
+ %% but can be easily restored (just delete the name from the list in the array). In future
+ %% we may remove the operator and the code implementation entirely.
+ [
+ /.bitadd /.charboxpath /.cond /.countexecstack /.execstack /.runandhide /.popdevicefilter
+ /.execfile /.filenamesplit /.file_name_parent
+ /.setdefaultmatrix /.isprocfilter /.unread /.psstringencode
+ /.buildsampledfunction /.isencapfunction /.currentaccuratecurves /.currentcurvejoin /.currentdashadapt /.currentdotlength
+ /.currentlimitclamp /.dotorientation /.setaccuratecurves /.setcurvejoin /.setdashadapt /.setdotorientation
+ /.setlimitclamp /.currentscreenlevels /.dashpath /.pathbbox /.identeq /.identne /.tokenexec /.forgetsave /.pantonecallback
+
+ %% Used by our own test suite files
+ %%/.setdotlength % Bug687720.ps
+ ]
+ {systemdict exch .forceundef} forall
+
+ %% This list of operators are used internally by various parts of the Ghostscript startup code.
+ %% Since each operator is a potential security vulnerability, and any operator listed here
+ %% is not required once the initialisation is complete and functions are bound, we undefine
+ %% the ones that aren't needed at runtime.
+ [
+ /.callinstall /.callbeginpage /.callendpage
+ /.currentstackprotect /.setstackprotect /.errorexec /.finderrorobject /.installsystemnames /.bosobject /.fontbbox
+ /.type1execchar /.type2execchar /.type42execchar /.setweightvector /.getuseciecolor /processcolors /.includecolorspace
+ /.execn /.instopped /.stop /.stopped /.setcolorrendering /.setdevicecolorrendering /.buildcolorrendering1 /.builddevicecolorrendering1
+ /.TransformPQR_scale_WB0 /.TransformPQR_scale_WB1 /.TransformPQR_scale_WB2 /.currentoverprintmode /.copydevice2
+ /.devicename /.doneshowpage /.getbitsrect /.getdevice /.getdefaultdevice /.getdeviceparams /.gethardwareparams
+ /makewordimagedevice /.outputpage /.putdeviceparams /.setdevice /.currentshowpagecount
+ /.setpagedevice /.currentpagedevice /.knownundef /.setmaxlength /.rectappend /.initialize_dsc_parser /.parse_dsc_comments
+ /.fillCIDMap /.fillIdentityCIDMap /.buildcmap /.filenamelistseparator /.libfile /.getfilename
+ /.file_name_combine /.file_name_is_absolute /.file_name_separator /.file_name_directory_separator /.file_name_current /.filename
+ /.peekstring /.writecvp /.subfiledecode /.setupUnicodeDecoder /.jbig2makeglobalctx /.registerfont /.parsecff
+ /.getshowoperator /.getnativefonts /.beginform /.endform /.get_form_id /.repeatform /.reusablestream /.rsdparams
+ /.buildfunction /.currentfilladjust2 /.setfilladjust2 /.sethpglpathmode /.currenthpglpathmode
+ /.currenthalftone /.sethalftone5 /.image1 /.imagemask1 /.image3 /.image4
+ /.getiodevice /.getdevparms /.putdevparams /.bbox_transform /.matchmedia /.matchpagesize /.defaultpapersize
+ /.oserrno /.setoserrno /.oserrorstring /.getCPSImode
+ /.getscanconverter /.setscanconverter /.type1encrypt /.type1decrypt/.languagelevel /.setlanguagelevel /.eqproc /.fillpage /.buildpattern1 /.saslprep
+ /.buildshading1 /.buildshading2 /.buildshading3 /.buildshading4 /.buildshading5 /.buildshading6 /.buildshading7 /.buildshadingpattern
+ /.shfill /.argindex /.bytestring /.namestring /.stringbreak /.stringmatch /.globalvmarray /.globalvmdict /.globalvmpackedarray /.globalvmstring
+ /.localvmarray /.localvmdict /.localvmpackedarray /.localvmstring /.systemvmarray /.systemvmdict /.systemvmpackedarray /.systemvmstring /.systemvmfile /.systemvmlibfile
+ /.systemvmSFD /.settrapparams /.currentsystemparams /.currentuserparams /.getsystemparam /.getuserparam /.setsystemparams /.setuserparams
+ /.checkpassword /.locale_to_utf8 /.currentglobal /.gcheck /.imagepath
+
+ % Used by a free user in the Library of Congress. Apparently this is used to
+ % draw a partial page, which is then filled in by the results of a barcode
+ % scanner and SQL database lookup. Its not clear to us exactly why this needs to be
+ % done as a partial page, but its easiest to restore the operator, and it seems like
+ % its a reasonably safe operator to restore, for the *very* few devices on which
+ % it will have any effect. Currently this uses the 'sync_output' device method
+ % to transfer the partial page, in future we may use a spec_op instead.
+ %/flushpage
+
+ % Used by our own test suite files
+ %/.fileposition %image-qa.ps
+ %/.makeoperator /.setCPSImode % gs_cet.ps
+
+ % Either our code uses these in ways which mean they can't be undefined, or they are used directly by
+ % test files/utilities, or engineers expressed a desire to keep them visible.
+ %
+ %/currentdevice /.sort /.buildfont0 /.buildfont1 /.buildfont2 /.buildfont3 /.buildfont4 /.buildfont9 /.buildfont10 /.buildfont11
+ %/.buildfotn32 /.buildfont42 /.type9mapcid /.type11mapcid /.swapcolors
+ %/currentdevice /.quit /.setuseciecolor /.needinput /.setoverprintmode /.special_op /.dicttomark /.knownget
+ %/.FAPIavailable /.FAPIpassfont /.FAPIrebuildfont /.FAPIBuildGlyph /.FAPIBuildChar /.FAPIBuildGlyph9
+ %/.tempfile /.numicc_components /.set_outputintent /.max /.min /.vmreclaim /.getpath /.setglobal
+ %/.setdebug /.mementolistnewblocks /getenv
+ ]
+ {systemdict exch .forceundef} forall
+
+ //systemdict /UndefinePostScriptOperators .forceundef
+} .bind executeonly def % must be bound and hidden for .forceundef
/UndefinePDFOperators {
-%% This list of operators are used internally by various parts of the Ghostscript PDF interpreter.
-%% Since each operator is a potential security vulnerability, and any operator listed here
-%% is not required once the initislisation is complete and functions are bound, we undefine
-%% the ones that aren't needed at runtime.
-[
-/.pdfawidthshow /.pdfwidthshow /.currentblackptcomp /.setblackptcomp
-/.setfillcolor /.setfillcolorspace /.setstrokecolor /.setstrokecolorspace /.currentrenderingintent /.setrenderingintent
-/.currenttextrenderingmode /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading
-/.settextrise /.currenttextrise /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling
-/.settextlinematrix /.currenttextlinematrix /.currenttextmatrix /.settextmatrix /.currentblendmode
-/.currentopacityalpha /.currentshapealpha /.currenttextknockout
-/.pushextendedgstate /.popextendedgstate /.begintransparencytextgroup
-/.endtransparencytextgroup /.begintransparencymaskgroup /.begintransparencymaskimage /.endtransparencymask /.image3x
-/.abortpdf14devicefilter /.pdfinkpath /.pdfFormName /.setstrokeconstantalpha
-/.setfillconstantalpha /.setalphaisshape /.currentalphaisshape
-/.settextspacing /.currenttextspacing /.settextleading /.currenttextleading /.settextrise /.currenttextrise
-/.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling /.setPDFfontsize /.currentPDFfontsize
-
-% Used by our own test suite files
-%/.pushpdf14devicefilter % transparency-example.ps
-%/.poppdf14devicefilter % transparency-example.ps
-%/.setopacityalpha % transparency-example.ps
-%/.setshapealpha % transparency-example.ps
-%/.endtransparencygroup % transparency-example.ps
-
-% undefining these causes errors/incorrect output
-%/.settextrenderingmode /.setblendmode /.begintransparencygroup /.settextknockout /check_r6_password /.setstrokeoverprint /.setfilloverprint
-%/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha
-]
-{systemdict exch .forceundef} forall
-//systemdict /UndefinePDFOperators .forceundef
-} bind def
+ %% This list of operators are used internally by various parts of the Ghostscript PDF interpreter.
+ %% Since each operator is a potential security vulnerability, and any operator listed here
+ %% is not required once the initislisation is complete and functions are bound, we undefine
+ %% the ones that aren't needed at runtime.
+ %% This function is only called if DELAYBIND is true. It is a copy of the code at the end of pdf_main.ps
+ %% and must be maintained in parallel with it.
+ [
+ /.pdfawidthshow /.pdfwidthshow /.currentblackptcomp /.setblackptcomp
+ /.setfillcolor /.setfillcolorspace /.setstrokecolor /.setstrokecolorspace /.currentrenderingintent /.setrenderingintent
+ /.currenttextrenderingmode /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading
+ /.settextrise /.currenttextrise /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling
+ /.settextlinematrix /.currenttextlinematrix /.currenttextmatrix /.settextmatrix /.currentblendmode
+ /.currentopacityalpha /.currentshapealpha /.currenttextknockout
+ /.pushextendedgstate /.popextendedgstate /.begintransparencytextgroup
+ /.endtransparencytextgroup /.begintransparencymaskgroup /.begintransparencymaskimage /.endtransparencymask /.image3x
+ /.abortpdf14devicefilter /.pdfinkpath /.pdfFormName /.setstrokeconstantalpha
+ /.setfillconstantalpha /.setalphaisshape /.currentalphaisshape
+ /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading /.settextrise /.currenttextrise
+ /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling /.setPDFfontsize /.currentPDFfontsize
+ /.setdistillerparams
+
+ % undefining these causes errors/incorrect output
+ %/.settextrenderingmode /.setblendmode /.begintransparencygroup /.settextknockout /check_r6_password /.setstrokeoverprint /.setfilloverprint
+ %/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha
+ ]
+ {systemdict exch .forceundef} forall
+ //systemdict /UndefinePDFOperators .forceundef
+} .bind executeonly def % must be bound and hidden for .forceundef
% If we delayed binding, make it possible to do it later.
/.bindnow {
@@ -2262,8 +2284,11 @@ SAFER { .setsafeglobal } if
//systemdict /.delaybind {} .forceput % reclaim the space
//systemdict /.bindnow .forceundef % ditto
put
-% //systemdict /UndefinePostScriptOperators get exec
-% //systemdict /UndefinePDFOperators get exec
+ SAFER {
+ //systemdict /SAFERUndefinePostScriptOperators get exec
+ } if
+ //systemdict /UndefinePostScriptOperators get exec
+ //systemdict /UndefinePDFOperators get exec
//systemdict /.forcecopynew .forceundef % remove temptation
//systemdict /.forcedef .forceundef % ditto
//systemdict /.forceput .forceundef % ditto
@@ -2375,6 +2400,9 @@ currentdict /.renderingintentdict .undef
%% If we are using DELAYBIND we have to defer the undefinition
%% until .bindnow.
DELAYBIND not {
+ SAFER {
+ //systemdict /SAFERUndefinePostScriptOperators get exec
+ } if
//systemdict /UndefinePostScriptOperators get exec
//systemdict /UndefinePDFOperators .forceundef
} if
@@ -2385,6 +2413,7 @@ end
{ pop NOGC not { 2 .vmreclaim 0 vmreclaim } if
} if
DELAYBIND not {
+ systemdict /.bindnow .undef % We only need this for DELAYBIND
systemdict /.forcecopynew .undef % remove temptation
systemdict /.forcedef .undef % ditto
systemdict /.forceput .undef % ditto