diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2018-09-05 17:14:59 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2018-09-06 17:14:28 +0100 |
commit | 3e5d316b72e3965b7968bb1d96baa137cd063ac6 (patch) | |
tree | ba1fefe52b79de5b25a4b3529bb2526c8f3ec7db /Resource/Init/gs_setpd.ps | |
parent | c8c01f8c4164bc10281d9e8f87cf96314d93104b (diff) | |
download | ghostpdl-3e5d316b72e3965b7968bb1d96baa137cd063ac6.tar.gz |
Bug 699718: Ensure stack space is available before gsrestore call out
During a grestore, if the device is going to change, we call out to Postscript
to restore the device configuration, before returning to restore the graphics
state internally.
We have to ensure sufficient op stack space is available to complete the
operation, otherwise the device can end up an undefined state.
Diffstat (limited to 'Resource/Init/gs_setpd.ps')
-rw-r--r-- | Resource/Init/gs_setpd.ps | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Resource/Init/gs_setpd.ps b/Resource/Init/gs_setpd.ps index b75c4312a..8fa7c51df 100644 --- a/Resource/Init/gs_setpd.ps +++ b/Resource/Init/gs_setpd.ps @@ -96,7 +96,7 @@ level2dict begin % we must (carefully) reinstall the old parameters in % the same device. .currentpagedevice pop //null currentdevice //null - {.trysetparams} .internalstopped + { .trysetparams } .internalstopped { //null } if @@ -104,26 +104,32 @@ level2dict begin { pop pop } { SETPDDEBUG { (Error in .trysetparams!) = pstack flush } if - cleartomark pop pop pop + {cleartomark pop pop pop} .internalstopped pop % if resetting the entire device state failed, at least put back the % security related key - currentdevice //null //false mark /.LockSafetyParams .currentpagedevice pop - /.LockSafetyParams .knownget not {//false} if .putdeviceparamsonly + currentdevice //null //false mark /.LockSafetyParams + currentpagedevice /.LockSafetyParams .knownget not + {systemdict /SAFER .knownget not {//false} } if + .putdeviceparamsonly /.installpagedevice cvx /rangecheck signalerror } ifelse pop pop % A careful reading of the Red Book reveals that an erasepage % should occur, but *not* an initgraphics. erasepage .beginpage - } bind def + } bind executeonly def /.uninstallpagedevice - { 2 .endpage { .currentnumcopies //false .outputpage } if + { + {2 .endpage { .currentnumcopies //false .outputpage } if} .internalstopped pop nulldevice } bind def (%grestorepagedevice) cvn - { .uninstallpagedevice grestore .installpagedevice + { + .uninstallpagedevice + grestore + .installpagedevice } bind def (%grestoreallpagedevice) cvn |