Brad Bishop | d89cb5f | 2019-04-10 09:02:41 -0400 | [diff] [blame^] | 1 | From ad3ad6b389653722507e588c5cb34d8731e49e89 Mon Sep 17 00:00:00 2001 |
| 2 | From: Chris Liddell <chris.liddell@artifex.com> |
| 3 | Date: Mon, 26 Nov 2018 18:01:25 +0000 |
| 4 | Subject: [PATCH] Have gs_cet.ps run from gs_init.ps |
| 5 | |
| 6 | Previously gs_cet.ps was run on the command line, to set up the interpreter |
| 7 | state so our output more closely matches the example output for the QL CET |
| 8 | tests. |
| 9 | |
| 10 | Allow a -dCETMODE command line switch, which will cause gs_init.ps to run the |
| 11 | file directly. |
| 12 | |
| 13 | This works better for gpdl as it means the changes are made in the intial |
| 14 | interpreter state, rather than after initialisation is complete. |
| 15 | |
| 16 | This also means adding a definition of the default procedure for black |
| 17 | generation and under color removal (rather it being defined in-line in |
| 18 | .setdefaultbgucr |
| 19 | |
| 20 | Also, add a check so gs_cet.ps only runs once - if we try to run it a second |
| 21 | time, we'll just skip over the file, flushing through to the end. |
| 22 | |
| 23 | CVE: CVE-2019-3835 |
| 24 | Upstream-Status: Backport [git://git.ghostscript.com/ghostpdl.git] |
| 25 | |
| 26 | Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> |
| 27 | --- |
| 28 | Resource/Init/gs_cet.ps | 11 ++++++++++- |
| 29 | Resource/Init/gs_init.ps | 13 ++++++++++++- |
| 30 | 2 files changed, 22 insertions(+), 2 deletions(-) |
| 31 | |
| 32 | diff --git a/Resource/Init/gs_cet.ps b/Resource/Init/gs_cet.ps |
| 33 | index d3e1686..75534bb 100644 |
| 34 | --- a/Resource/Init/gs_cet.ps |
| 35 | +++ b/Resource/Init/gs_cet.ps |
| 36 | @@ -1,6 +1,11 @@ |
| 37 | %!PS |
| 38 | % Set defaults for Ghostscript to match Adobe CPSI behaviour for CET |
| 39 | |
| 40 | +systemdict /product get (PhotoPRINT SE 5.0v2) readonly eq |
| 41 | +{ |
| 42 | + (%END GS_CET) .skipeof |
| 43 | +} if |
| 44 | + |
| 45 | % do this in the server level so it is persistent across jobs |
| 46 | //true 0 startjob not { |
| 47 | (*** Warning: CET startup is not in server default) = flush |
| 48 | @@ -25,7 +30,9 @@ currentglobal //true setglobal |
| 49 | |
| 50 | /UNROLLFORMS true def |
| 51 | |
| 52 | -{ } bind dup |
| 53 | +(%.defaultbgrucrproc) cvn { } bind def |
| 54 | + |
| 55 | +(%.defaultbgrucrproc) cvn load dup |
| 56 | setblackgeneration |
| 57 | setundercolorremoval |
| 58 | 0 array cvx readonly dup dup dup setcolortransfer |
| 59 | @@ -109,3 +116,5 @@ userdict /.smoothness currentsmoothness put |
| 60 | % end of slightly nasty hack to give consistent cluster results |
| 61 | |
| 62 | //false 0 startjob pop % re-enter encapsulated mode |
| 63 | + |
| 64 | +%END GS_CET |
| 65 | diff --git a/Resource/Init/gs_init.ps b/Resource/Init/gs_init.ps |
| 66 | index 45bebf4..e6b9cd2 100644 |
| 67 | --- a/Resource/Init/gs_init.ps |
| 68 | +++ b/Resource/Init/gs_init.ps |
| 69 | @@ -1538,10 +1538,18 @@ setpacking |
| 70 | % any-part-of-pixel rule. |
| 71 | 0.5 .setfilladjust |
| 72 | } bind def |
| 73 | + |
| 74 | % Set the default screen and BG/UCR. |
| 75 | +% We define the proc here, rather than inline in .setdefaultbgucr |
| 76 | +% for the benefit of gs_cet.ps so jobs that do anything that causes |
| 77 | +% .setdefaultbgucr to be called will still get the redefined proc |
| 78 | +% in gs_cet.ps |
| 79 | +(%.defaultbgrucrproc) cvn { pop 0 } def |
| 80 | + |
| 81 | /.setdefaultbgucr { |
| 82 | systemdict /setblackgeneration known { |
| 83 | - { pop 0 } dup setblackgeneration setundercolorremoval |
| 84 | + (%.defaultbgrucrproc) cvn load dup |
| 85 | + setblackgeneration setundercolorremoval |
| 86 | } if |
| 87 | } bind def |
| 88 | /.useloresscreen { % - .useloresscreen <bool> |
| 89 | @@ -2491,4 +2499,7 @@ WRITESYSTEMDICT { |
| 90 | % be 'true' in some cases. |
| 91 | userdict /AGM_preserve_spots //false put |
| 92 | |
| 93 | +systemdict /CETMODE .knownget |
| 94 | +{ { (gs_cet.ps) runlibfile } if } if |
| 95 | + |
| 96 | % The interpreter will run the initial procedure (start). |
| 97 | -- |
| 98 | 2.18.1 |
| 99 | |