|
|
518276 |
From: Ken Sharp <ken.sharp@artifex.com>
|
|
|
518276 |
Date: Fri, 21 Sep 2018 14:28:15 +0000 (+0100)
|
|
|
518276 |
Subject: pdfwrite - fix DSC comment parsing
|
|
|
518276 |
|
|
|
518276 |
pdfwrite - fix DSC comment parsing
|
|
|
518276 |
|
|
|
518276 |
This may affect other DSC parsing utilities. For some reason double
|
|
|
518276 |
comment (%%) marks are being interpreted 'sometimes' in gs_init.ps
|
|
|
518276 |
as DSC comments. This only happens when reading the init files from disk
|
|
|
518276 |
becuase the ROM file system strips comments.
|
|
|
518276 |
|
|
|
518276 |
Passing these to pdfwrite causes it to drop later DSC comments, such
|
|
|
518276 |
as %%Title: and %%Creator: which meant the information wasn't being
|
|
|
518276 |
embedded in the document information dictionary.
|
|
|
518276 |
|
|
|
518276 |
Fix by converting double %% to single % comments, document this in the
|
|
|
518276 |
header of gs_init.ps.
|
|
|
518276 |
|
|
|
518276 |
https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=f31702b38fba21153e26c3417c838618e7cfd16f
|
|
|
518276 |
---
|
|
|
518276 |
|
|
|
518276 |
diff -up ghostscript-9.07/Resource/Init/gs_init.ps.comment_fix ghostscript-9.07/Resource/Init/gs_init.ps
|
|
|
f1e96c |
--- ghostscript-9.07/Resource/Init/gs_init.ps.comment_fix 2019-02-28 11:02:59.540694185 +0100
|
|
|
f1e96c |
+++ ghostscript-9.07/Resource/Init/gs_init.ps 2019-02-28 11:05:31.182710227 +0100
|
|
|
518276 |
@@ -20,6 +20,11 @@
|
|
|
518276 |
% %% Replace <n> <file(s)>
|
|
|
518276 |
% indicate places where the next <n> lines should be replaced by
|
|
|
518276 |
% the contents of <file(s)>, when creating a single merged init file.
|
|
|
518276 |
+%
|
|
|
518276 |
+% For reasons not clear to me, some cases of %% are being treated as
|
|
|
518276 |
+% DSC comments when (and only when) the resource files are disk based
|
|
|
518276 |
+% This can kill DSC parsing for pdfwrite at least, so avoid using
|
|
|
518276 |
+% double % comments in this file.
|
|
|
518276 |
|
|
|
518276 |
% The interpreter can call out to PostScript code. All procedures
|
|
|
518276 |
% called in this way, and no other procedures defined in these
|
|
|
518276 |
@@ -2132,22 +2137,22 @@ SAFER { .setsafe } if
|
|
|
518276 |
|
|
|
518276 |
/UndefinePostScriptOperators {
|
|
|
518276 |
|
|
|
f1e96c |
- %% This list is of Display PostScript operators. We believe that Display PostScript
|
|
|
f1e96c |
- %% was never fully implemented and the only known user, GNUStep, is no longer
|
|
|
f1e96c |
- %% using it. So lets remove it.
|
|
|
f1e96c |
+ % This list is of Display PostScript operators. We believe that Display PostScript
|
|
|
f1e96c |
+ % was never fully implemented and the only known user, GNUStep, is no longer
|
|
|
f1e96c |
+ % using it. So lets remove it.
|
|
|
f1e96c |
[
|
|
|
f1e96c |
/condition /currentcontext /detach /.fork /join /.localfork /lock /monitor /notify
|
|
|
f1e96c |
/wait /yield /.currentscreenphase /.setscreenphase /.image2 /eoviewclip /initviewclip
|
|
|
f1e96c |
/viewclip /viewclippath /defineusername
|
|
|
f1e96c |
- %% NeXT DPS extensions
|
|
|
f1e96c |
+ % NeXT DPS extensions
|
|
|
f1e96c |
/currentalpha /setalpha /.alphaimage /composite /compositerect /dissolve /sizeimagebox /.sizeimageparams
|
|
|
f1e96c |
]
|
|
|
f1e96c |
{systemdict exch .forceundef} forall
|
|
|
518276 |
|
|
|
f1e96c |
- %% This list is of operators which no longer appear to be used, and which we do not believe
|
|
|
f1e96c |
- %% to have any real use. For now we will undefine the operstors so they cannot easily be used
|
|
|
f1e96c |
- %% but can be easily restored (just delete the name from the list in the array). In future
|
|
|
f1e96c |
- %% we may remove the operator and the code implementation entirely.
|
|
|
f1e96c |
+ % This list is of operators which no longer appear to be used, and which we do not believe
|
|
|
f1e96c |
+ % to have any real use. For now we will undefine the operstors so they cannot easily be used
|
|
|
f1e96c |
+ % but can be easily restored (just delete the name from the list in the array). In future
|
|
|
f1e96c |
+ % we may remove the operator and the code implementation entirely.
|
|
|
f1e96c |
[
|
|
|
f1e96c |
/.bitadd /.charboxpath /.cond /.runandhide /.popdevicefilter
|
|
|
f1e96c |
/.execfile /.filenamesplit /.file_name_parent
|
|
|
518276 |
@@ -2156,15 +2161,15 @@ SAFER { .setsafe } if
|
|
|
f1e96c |
/.currentlimitclamp /.dotorientation /.setaccuratecurves /.setcurvejoin /.setdashadapt /.setdotorientation
|
|
|
f1e96c |
/.setlimitclamp /.currentscreenlevels /.dashpath /.pathbbox /.identeq /.identne /.tokenexec /.forgetsave /.pantonecallback
|
|
|
518276 |
|
|
|
f1e96c |
- %% Used by our own test suite files
|
|
|
f1e96c |
- %%/.setdotlength % Bug687720.ps
|
|
|
f1e96c |
+ % Used by our own test suite files
|
|
|
f1e96c |
+ %/.setdotlength % Bug687720.ps
|
|
|
f1e96c |
]
|
|
|
f1e96c |
{systemdict exch .forceundef} forall
|
|
|
518276 |
|
|
|
f1e96c |
- %% This list of operators are used internally by various parts of the Ghostscript startup code.
|
|
|
f1e96c |
- %% Since each operator is a potential security vulnerability, and any operator listed here
|
|
|
f1e96c |
- %% is not required once the initislisation is complete and functions are bound, we undefine
|
|
|
f1e96c |
- %% the ones that aren't needed at runtime.
|
|
|
f1e96c |
+ % This list of operators are used internally by various parts of the Ghostscript startup code.
|
|
|
f1e96c |
+ % Since each operator is a potential security vulnerability, and any operator listed here
|
|
|
f1e96c |
+ % is not required once the initislisation is complete and functions are bound, we undefine
|
|
|
f1e96c |
+ % the ones that aren't needed at runtime.
|
|
|
f1e96c |
[
|
|
|
f1e96c |
/.callinstall /.callbeginpage /.callendpage
|
|
|
f1e96c |
/.currentstackprotect /.setstackprotect /.errorexec /.finderrorobject /.installsystemnames /.bosobject /.fontbbox
|
|
|
f1e96c |
@@ -2236,10 +2241,10 @@ SAFER { .setsafe } if
|
|
|
f1e96c |
} .bind executeonly def % must be bound and hidden for .forceundef
|
|
|
518276 |
|
|
|
518276 |
/UndefinePDFOperators {
|
|
|
f1e96c |
- %% This list of operators are used internally by various parts of the Ghostscript PDF interpreter.
|
|
|
f1e96c |
- %% Since each operator is a potential security vulnerability, and any operator listed here
|
|
|
f1e96c |
- %% is not required once the initislisation is complete and functions are bound, we undefine
|
|
|
f1e96c |
- %% the ones that aren't needed at runtime.
|
|
|
f1e96c |
+ % This list of operators are used internally by various parts of the Ghostscript PDF interpreter.
|
|
|
f1e96c |
+ % Since each operator is a potential security vulnerability, and any operator listed here
|
|
|
f1e96c |
+ % is not required once the initislisation is complete and functions are bound, we undefine
|
|
|
f1e96c |
+ % the ones that aren't needed at runtime.
|
|
|
f1e96c |
[
|
|
|
f1e96c |
/.pdfawidthshow /.pdfwidthshow
|
|
|
f1e96c |
/.setfillcolor /.setfillcolorspace /.setstrokecolor /.setstrokecolorspace /.currentrenderingintent /.setrenderingintent
|
|
|
f1e96c |
@@ -2380,8 +2385,8 @@ currentdict /.shadingtypes .undef
|
|
|
518276 |
currentdict /.wheredict .undef
|
|
|
518276 |
currentdict /.renderingintentdict .undef
|
|
|
518276 |
|
|
|
518276 |
-%% If we are using DELAYBIND we have to defer the undefinition
|
|
|
518276 |
-%% until .bindnow.
|
|
|
518276 |
+% If we are using DELAYBIND we have to defer the undefinition
|
|
|
518276 |
+% until .bindnow.
|
|
|
518276 |
DELAYBIND not {
|
|
|
518276 |
SAFER {
|
|
|
518276 |
//systemdict /SAFERUndefinePostScriptOperators get exec
|
|
|
f1e96c |
@@ -2408,7 +2413,7 @@ systemdict /superexec .knownget {
|
|
|
f1e96c |
systemdict /superexec .undef
|
|
|
518276 |
} if
|
|
|
518276 |
|
|
|
518276 |
-%% Can't remove this one until the last minute :-)
|
|
|
518276 |
+% Can't remove this one until the last minute :-)
|
|
|
518276 |
systemdict /.undef .undef
|
|
|
518276 |
|
|
|
518276 |
WRITESYSTEMDICT not { systemdict readonly pop } if
|