diff options
-rw-r--r-- | Resource/Init/gs_init.ps | 193 | ||||
-rw-r--r-- | Resource/Init/pdf_main.ps | 2 |
2 files changed, 122 insertions, 73 deletions
diff --git a/Resource/Init/gs_init.ps b/Resource/Init/gs_init.ps index 589e05063..ca76ec615 100644 --- a/Resource/Init/gs_init.ps +++ b/Resource/Init/gs_init.ps | |||
@@ -2110,6 +2110,118 @@ readonly def | |||
2110 | % If we are running in SAFER mode, lock things down | 2110 | % If we are running in SAFER mode, lock things down |
2111 | SAFER { .setsafeglobal } if | 2111 | SAFER { .setsafeglobal } if |
2112 | 2112 | ||
2113 | /UndefinePostScriptOperators { | ||
2114 | |||
2115 | %% This list is of Display PostScript operators. We believe that Display PostScript | ||
2116 | %% was never fully implemented and the only known user, GNUStep, is no longer | ||
2117 | %% using it. So lets remove it. | ||
2118 | [ | ||
2119 | /condition /currentcontext /detach /.fork /join /.localfork /lock /monitor /notify | ||
2120 | /wait /yield /.currentscreenphase /.setscreenphase /.image2 /eoviewclip /initviewclip | ||
2121 | /viewclip /viewclippath /defineusername | ||
2122 | %% NeXT DPS extensions | ||
2123 | /currentalpha /setalpha /.alphaimage /composite /compositerect /dissolve /sizeimagebox /.sizeimageparams | ||
2124 | ] | ||
2125 | {systemdict exch .forceundef} forall | ||
2126 | |||
2127 | %% This list is of operators which no longer appear to be used, and which we do not believe | ||
2128 | %% to have any real use. For now we will undefine the operstors so they cannot easily be used | ||
2129 | %% but can be easily restored (just delete the name from the list in the array). In future | ||
2130 | %% we may remove the operator and the code implementation entirely. | ||
2131 | [ | ||
2132 | /.bitadd /.charboxpath /.currentblackptcomp /.setblackptcomp /.cond /.countexecstack /.execstack /.runandhide /.popdevicefilter | ||
2133 | /.execfile /.filenamesplit /.file_name_parent | ||
2134 | /.setdefaultmatrix /.isprocfilter /.unread /.psstringencode | ||
2135 | /.buildsampledfunction /.isencapfunction /.currentaccuratecurves /.currentcurvejoin /.currentdashadapt /.currentdotlength | ||
2136 | /.currentlimitclamp /.dotorientation /.setaccuratecurves /.setcurvejoin /.setdashadapt /.setdotorientation | ||
2137 | /.setlimitclamp /.currentscreenlevels /.dashpath /.pathbbox /.identeq /.identne /.tokenexec /.forgetsave /.pantonecallback | ||
2138 | |||
2139 | %% Used by our own test suite files | ||
2140 | %%/.setdotlength % Bug687720.ps | ||
2141 | ] | ||
2142 | {systemdict exch .forceundef} forall | ||
2143 | |||
2144 | %% This list of operators are used internally by various parts of the Ghostscript startup code. | ||
2145 | %% Since each operator is a potential security vulnerability, and any operator listed here | ||
2146 | %% is not required once the initislisation is complete and functions are bound, we undefine | ||
2147 | %% the ones that aren't needed at runtime. | ||
2148 | [ | ||
2149 | /.callinstall /.callbeginpage /.callendpage | ||
2150 | /.currentstackprotect /.setstackprotect /.errorexec /.finderrorobject /.installsystemnames /.bosobject /.fontbbox | ||
2151 | /.type1execchar /.type2execchar /.type42execchar /.setweightvector /.getuseciecolor /processcolors /.includecolorspace | ||
2152 | /.execn /.instopped /.stop /.stopped /.setcolorrendering /.setdevicecolorrendering /.buildcolorrendering1 /.builddevicecolorrendering1 | ||
2153 | /.TransformPQR_scale_WB0 /.TransformPQR_scale_WB1 /.TransformPQR_scale_WB2 /.currentoverprintmode /.copydevice2 | ||
2154 | /.devicename /.doneshowpage /flushpage /.getbitsrect /.getdevice /.getdefaultdevice /.getdeviceparams /.gethardwareparams | ||
2155 | /makewordimagedevice /.outputpage /.putdeviceparams /.setdevice /.currentshowpagecount | ||
2156 | /.setpagedevice /.currentpagedevice /.knownundef /.setmaxlength /.rectappend /.initialize_dsc_parser /.parse_dsc_comments | ||
2157 | /.fillCIDMap /.fillIdentityCIDMap /.buildcmap /.filenamelistseparator /.libfile /.getfilename | ||
2158 | /.file_name_combine /.file_name_is_absolute /.file_name_separator /.file_name_directory_separator /.file_name_current /.filename | ||
2159 | /.peekstring /.writecvp /.subfiledecode /.setupUnicodeDecoder /.jbig2makeglobalctx /.registerfont /.parsecff | ||
2160 | /.getshowoperator /.getnativefonts /.beginform /.endform /.get_form_id /.repeatform /.reusablestream /.rsdparams | ||
2161 | /.buildfunction /.currentfilladjust2 /.setfilladjust2 /.sethpglpathmode /.currenthpglpathmode | ||
2162 | /.currenthalftone /.sethalftone5 /.image1 /.imagemask1 /.image3 /.image4 | ||
2163 | /.getiodevice /.getdevparms /.putdevparams /.bbox_transform /.matchmedia /.matchpagesize /.defaultpapersize | ||
2164 | /.oserrno /.setoserrno /.oserrorstring /.getCPSImode | ||
2165 | /.getscanconverter /.setscanconverter /.type1encrypt /.type1decrypt/.languagelevel /.setlanguagelevel /.eqproc /.fillpage /.buildpattern1 /.saslprep | ||
2166 | /.buildshading1 /.buildshadin2 /.buildshading3 /.buildshading4 /.buildshading5 /.buildshading6 /.buildshading7 /.buildshadingpattern | ||
2167 | /.argindex /.bytestring /.namestring /.stringbreak /.stringmatch /.globalvmarray /.globalvmdict /.globalvmpackedarray /.globalvmstring | ||
2168 | /.localvmarray /.localvmdict /.localvmpackedarray /.localvmstring /.systemvmarray /.systemvmdict /.systemvmpackedarray /.systemvmstring /.systemvmfile /.systemvmlibfile | ||
2169 | /.systemvmSFD /.settrapparams /.currentsystemparams /.currentuserparams /.getsystemparam /.getuserparam /.setsystemparams /.setuserparams | ||
2170 | /.checkpassword /.locale_to_utf8 /.currentglobal /.gcheck /.imagepath | ||
2171 | |||
2172 | % Used by our own test suite files | ||
2173 | %/.fileposition %image-qa.ps | ||
2174 | %/.makeoperator /.setCPSImode % gs_cet.ps | ||
2175 | |||
2176 | % Either our code uses these in ways which mean they can't be undefined, or they are used directly by | ||
2177 | % test files/utilities, or engineers expressed a desire to keep them visible. | ||
2178 | % | ||
2179 | %/currentdevice /.sort /.buildfont0 /.buildfont1 /.buildfont2 /.buildfont3 /.buildfont4 /.buildfont9 /.buildfont10 /.buildfont11 | ||
2180 | %/.buildfotn32 /.buildfont42 /.type9mapcid /.type11mapcid /.swapcolors | ||
2181 | %/currentdevice /.quit /.setuseciecolor /.needinput /.setoverprintmode /.special_op /.dicttomark /.knownget | ||
2182 | %/.FAPIavailable /.FAPIpassfont /.FAPIrebuildfont /.FAPIBuildGlyph /.FAPIBuildChar /.FAPIBuildGlyph9 | ||
2183 | %/.tempfile /.numicc_components /.set_outputintent /.max /.min /.shfill /.vmreclaim /.getpath /.setglobal | ||
2184 | %/.setdebug /.mementolistnewblocks /getenv | ||
2185 | ] | ||
2186 | {systemdict exch .forceundef} forall | ||
2187 | |||
2188 | //systemdict /UndefinePostScriptOperators .forceundef | ||
2189 | } bind def | ||
2190 | |||
2191 | /UndefinePDFOperators { | ||
2192 | %% This list of operators are used internally by various parts of the Ghostscript PDF interpreter. | ||
2193 | %% Since each operator is a potential security vulnerability, and any operator listed here | ||
2194 | %% is not required once the initislisation is complete and functions are bound, we undefine | ||
2195 | %% the ones that aren't needed at runtime. | ||
2196 | [ | ||
2197 | /.pdfawidthshow /.pdfwidthshow | ||
2198 | /.setfillcolor /.setfillcolorspace /.setstrokecolor /.setstrokecolorspace /.currentrenderingintent /.setrenderingintent | ||
2199 | /.currenttextrenderingmode /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading | ||
2200 | /.settextrise /.currenttextrise /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling | ||
2201 | /.settextlinematrix /.currenttextlinematrix /.currenttextmatrix /.settextmatrix /.currentblendmode | ||
2202 | /.currentopacityalpha /.currentshapealpha /.currenttextknockout | ||
2203 | /.pushextendedgstate /.popextendedgstate /.begintransparencytextgroup | ||
2204 | /.endtransparencytextgroup /.begintransparencymaskgroup /.begintransparencymaskimage /.endtransparencymask /.image3x | ||
2205 | /.abortpdf14devicefilter /.pdfinkpath /.pdfFormName /.setstrokeconstantalpha | ||
2206 | /.setfillconstantalpha /.setalphaisshape /.currentalphaisshape | ||
2207 | /.settextspacing /.currenttextspacing /.settextleading /.currenttextleading /.settextrise /.currenttextrise | ||
2208 | /.setwordspacing /.currentwordspacing /.settexthscaling /.currenttexthscaling | ||
2209 | |||
2210 | % Used by our own test suite files | ||
2211 | %/.pushpdf14devicefilter % transparency-example.ps | ||
2212 | %/.poppdf14devicefilter % transparency-example.ps | ||
2213 | %/.setopacityalpha % transparency-example.ps | ||
2214 | %/.setshapealpha % transparency-example.ps | ||
2215 | %/.endtransparencygroup % transparency-example.ps | ||
2216 | |||
2217 | % undefining these causes errors/incorrect output | ||
2218 | %/.settextrenderingmode /.setblendmode /.begintransparencygroup /.settextknockout /check_r6_password /.setstrokeoverprint /.setfilloverprint | ||
2219 | %/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha | ||
2220 | ] | ||
2221 | {systemdict exch .forceundef} forall | ||
2222 | //systemdict /UndefinePDFOperators .forceundef | ||
2223 | } bind def | ||
2224 | |||
2113 | % If we delayed binding, make it possible to do it later. | 2225 | % If we delayed binding, make it possible to do it later. |
2114 | /.bindnow { | 2226 | /.bindnow { |
2115 | currentuserparams /IdiomRecognition .knownget { | 2227 | currentuserparams /IdiomRecognition .knownget { |
@@ -2123,6 +2235,8 @@ SAFER { .setsafeglobal } if | |||
2123 | //systemdict /.delaybind {} .forceput % reclaim the space | 2235 | //systemdict /.delaybind {} .forceput % reclaim the space |
2124 | //systemdict /.bindnow .forceundef % ditto | 2236 | //systemdict /.bindnow .forceundef % ditto |
2125 | put | 2237 | put |
2238 | % //systemdict /UndefinePostScriptOperators get exec | ||
2239 | % //systemdict /UndefinePDFOperators get exec | ||
2126 | //systemdict /.forcecopynew .forceundef % remove temptation | 2240 | //systemdict /.forcecopynew .forceundef % remove temptation |
2127 | //systemdict /.forcedef .forceundef % ditto | 2241 | //systemdict /.forcedef .forceundef % ditto |
2128 | //systemdict /.forceput .forceundef % ditto | 2242 | //systemdict /.forceput .forceundef % ditto |
@@ -2230,79 +2344,12 @@ currentdict /.shadingtypes .undef | |||
2230 | currentdict /.wheredict .undef | 2344 | currentdict /.wheredict .undef |
2231 | currentdict /.renderingintentdict .undef | 2345 | currentdict /.renderingintentdict .undef |
2232 | 2346 | ||
2233 | %% This list is of Display PostScript operators. We believe that Display PostScript | 2347 | %% If we are using DELAYBIND we have to defer the undefinition |
2234 | %% was never fully implemented and the only known user, GNUStep, is no longer | 2348 | %% until .bindnow. |
2235 | %% using it. So lets remove it. | 2349 | DELAYBIND not { |
2236 | [ | 2350 | //systemdict /UndefinePostScriptOperators get exec |
2237 | /condition /currentcontext /detach /.fork /join /.localfork /lock /monitor /notify | 2351 | //systemdict /UndefinePDFOperators .forceundef |
2238 | /wait /yield /.currentscreenphase /.setscreenphase /.image2 /eoviewclip /initviewclip | 2352 | } if |
2239 | /viewclip /viewclippath /defineusername | ||
2240 | %% NeXT DPS extensions | ||
2241 | /currentalpha /setalpha /.alphaimage /composite /compositerect /dissolve /sizeimagebox /.sizeimageparams | ||
2242 | ] | ||
2243 | {currentdict exch .undef} forall | ||
2244 | |||
2245 | %% This list is of operators which no longer appear to be used, and which we do not believe | ||
2246 | %% to have any real use. For now we will undefine the operstors so they cannot easily be used | ||
2247 | %% but can be easily restored (just delete the name from the list in the array). In future | ||
2248 | %% we may remove the operator and the code implementation entirely. | ||
2249 | [ | ||
2250 | /.bitadd /.charboxpath /.currentblackptcomp /.setblackptcomp /.cond /.countexecstack /.execstack /.runandhide /.popdevicefilter | ||
2251 | /.execfile /.filenamesplit /.file_name_parent | ||
2252 | /.setdefaultmatrix /.isprocfilter /.unread /.psstringencode | ||
2253 | /.buildsampledfunction /.isencapfunction /.currentaccuratecurves /.currentcurvejoin /.currentdashadapt /.currentdotlength | ||
2254 | /.currentlimitclamp /.dotorientation /.setaccuratecurves /.setcurvejoin /.setdashadapt /.setdotorientation | ||
2255 | /.setlimitclamp /.currentscreenlevels /.dashpath /.pathbbox /.identeq /.identne /.tokenexec /.forgetsave /.pantonecallback | ||
2256 | |||
2257 | % Used by our own test suite files | ||
2258 | %/.setdotlength % Bug687720.ps | ||
2259 | ] | ||
2260 | {currentdict exch .undef} forall | ||
2261 | |||
2262 | %% This list of operators are used internally by various parts of the Ghostscript startup code. | ||
2263 | %% Since each operator is a potential security vulnerability, and any operator listed here | ||
2264 | %% is not required once the initislisation is complete and functions are bound, we undefine | ||
2265 | %% the ones that aren't needed at runtime. | ||
2266 | [ | ||
2267 | /.callinstall /.callbeginpage /.callendpage | ||
2268 | /.currentstackprotect /.setstackprotect /.errorexec /.finderrorobject /.installsystemnames /.bosobject /.fontbbox | ||
2269 | /.type1execchar /.type2execchar /.type42execchar /.setweightvector /.getuseciecolor /processcolors /.includecolorspace | ||
2270 | /.execn /.instopped /.stop /.stopped /.setcolorrendering /.setdevicecolorrendering /.buildcolorrendering1 /.builddevicecolorrendering1 | ||
2271 | /.TransformPQR_scale_WB0 /.TransformPQR_scale_WB1 /.TransformPQR_scale_WB2 /.currentoverprintmode /.copydevice2 | ||
2272 | /.devicename /.doneshowpage /flushpage /.getbitsrect /.getdevice /.getdefaultdevice /.getdeviceparams /.gethardwareparams | ||
2273 | /makewordimagedevice /.outputpage /.putdeviceparams /.setdevice /.currentshowpagecount | ||
2274 | /.setpagedevice /.currentpagedevice /.knownundef /.setmaxlength /.rectappend /.initialize_dsc_parser /.parse_dsc_comments | ||
2275 | /.fillCIDMap /.fillIdentityCIDMap /.buildcmap /.filenamelistseparator /.libfile /.getfilename | ||
2276 | /.file_name_combine /.file_name_is_absolute /.file_name_separator /.file_name_directory_separator /.file_name_current /.filename | ||
2277 | /.peekstring /.writecvp /.subfiledecode /.setupUnicodeDecoder /.jbig2makeglobalctx /.registerfont /.parsecff | ||
2278 | /.getshowoperator /.getnativefonts /.beginform /.endform /.get_form_id /.repeatform /.reusablestream /.rsdparams | ||
2279 | /.buildfunction /.currentfilladjust2 /.setfilladjust2 /.sethpglpathmode /.currenthpglpathmode | ||
2280 | /.currenthalftone /.sethalftone5 /.image1 /.imagemask1 /.image3 /.image4 | ||
2281 | /.getiodevice /.getdevparms /.putdevparams /.bbox_transform /.matchmedia /.matchpagesize /.defaultpapersize | ||
2282 | /.oserrno /.setoserrno /.oserrorstring /.getCPSImode | ||
2283 | /.getscanconverter /.setscanconverter /.type1encrypt /.type1decrypt/.languagelevel /.setlanguagelevel /.eqproc /.fillpage /.buildpattern1 /.saslprep | ||
2284 | /.buildshading1 /.buildshadin2 /.buildshading3 /.buildshading4 /.buildshading5 /.buildshading6 /.buildshading7 /.buildshadingpattern | ||
2285 | /.argindex /.bytestring /.namestring /.stringbreak /.stringmatch /.globalvmarray /.globalvmdict /.globalvmpackedarray /.globalvmstring | ||
2286 | /.localvmarray /.localvmdict /.localvmpackedarray /.localvmstring /.systemvmarray /.systemvmdict /.systemvmpackedarray /.systemvmstring /.systemvmfile /.systemvmlibfile | ||
2287 | /.systemvmSFD /.settrapparams /.currentsystemparams /.currentuserparams /.getsystemparam /.getuserparam /.setsystemparams /.setuserparams | ||
2288 | /.checkpassword /.locale_to_utf8 /.currentglobal /.gcheck /.imagepath | ||
2289 | |||
2290 | % Used by our own test suite files | ||
2291 | %/.fileposition %image-qa.ps | ||
2292 | %/.makeoperator /.setCPSImode % gs_cet.ps | ||
2293 | |||
2294 | % Either our code uses these in ways which mean they can't be undefined, or they are used directly by | ||
2295 | % test files/utilities, or engineers expressed a desire to keep them visible. | ||
2296 | % | ||
2297 | %/currentdevice /.sort /.buildfont0 /.buildfont1 /.buildfont2 /.buildfont3 /.buildfont4 /.buildfont9 /.buildfont10 /.buildfont11 | ||
2298 | %/.buildfotn32 /.buildfont42 /.type9mapcid /.type11mapcid /.swapcolors | ||
2299 | %/currentdevice /.quit /.setuseciecolor /.needinput /.setoverprintmode /.special_op /.dicttomark /.knownget | ||
2300 | %/.FAPIavailable /.FAPIpassfont /.FAPIrebuildfont /.FAPIBuildGlyph /.FAPIBuildChar /.FAPIBuildGlyph9 | ||
2301 | %/.tempfile /.numicc_components /.set_outputintent /.max /.min /.shfill /.vmreclaim /.getpath /.setglobal | ||
2302 | %/.setdebug /.mementolistnewblocks /getenv | ||
2303 | ] | ||
2304 | {currentdict exch .undef} forall | ||
2305 | |||
2306 | end | 2353 | end |
2307 | 2354 | ||
2308 | % Clean up VM, and enable GC. Use .vmreclaim to force the GC. | 2355 | % Clean up VM, and enable GC. Use .vmreclaim to force the GC. |
diff --git a/Resource/Init/pdf_main.ps b/Resource/Init/pdf_main.ps index 56fda6696..26feac8d0 100644 --- a/Resource/Init/pdf_main.ps +++ b/Resource/Init/pdf_main.ps | |||
@@ -3123,6 +3123,7 @@ currentdict /PDF2PS_matrix_key undef | |||
3123 | end % pdfdict | 3123 | end % pdfdict |
3124 | .setglobal | 3124 | .setglobal |
3125 | 3125 | ||
3126 | DELAYBIND not { | ||
3126 | %% This list of operators are used internally by various parts of the Ghostscript PDF interpreter. | 3127 | %% This list of operators are used internally by various parts of the Ghostscript PDF interpreter. |
3127 | %% Since each operator is a potential security vulnerability, and any operator listed here | 3128 | %% Since each operator is a potential security vulnerability, and any operator listed here |
3128 | %% is not required once the initislisation is complete and functions are bound, we undefine | 3129 | %% is not required once the initislisation is complete and functions are bound, we undefine |
@@ -3153,3 +3154,4 @@ end % pdfdict | |||
3153 | %/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha | 3154 | %/.currentstrokeoverprint /.currentfilloverprint /.currentfillconstantalpha /.currentstrokeconstantalpha |
3154 | ] | 3155 | ] |
3155 | {systemdict exch .undef} forall | 3156 | {systemdict exch .undef} forall |
3157 | } if | ||