ghostscript/ghostscript-9.24-001-retain-LockSafetyParams.patch
2018-09-05 16:01:50 +02:00

42 lines
1.5 KiB
Diff

From 5812b1b78fc4d36fdc293b7859de69241140d590 Mon Sep 17 00:00:00 2001
From: Chris Liddell <chris.liddell@artifex.com>
Date: Tue, 4 Sep 2018 23:18:46 +0100
Subject: [PATCH] Bug 699714: retain .LockSafetyParams through failed
.installpagedevice
In the event that the .trysetparams fails during .installpagedevice, catch the
error, and ensure that at least the .LockSafetyParams is set.
---
Resource/Init/gs_setpd.ps | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/Resource/Init/gs_setpd.ps b/Resource/Init/gs_setpd.ps
index bba3c8c0e..aee96149e 100644
--- a/Resource/Init/gs_setpd.ps
+++ b/Resource/Init/gs_setpd.ps
@@ -95,12 +95,19 @@ level2dict begin
{ % Since setpagedevice doesn't create new device objects,
% we must (carefully) reinstall the old parameters in
% the same device.
- .currentpagedevice pop //null currentdevice //null .trysetparams
+ .currentpagedevice pop //null currentdevice //null
+ {.trysetparams} .internalstopped
+ {
+ //null
+ } if
dup type /booleantype eq
{ pop pop }
- { % This should never happen!
+ {
SETPDDEBUG { (Error in .trysetparams!) = pstack flush } if
cleartomark pop pop pop
+ % if resetting the entire device state failed, at least put back the se
+ currentdevice //null //false mark /.LockSafetyParams .currentpagedevice pop
+ /.LockSafetyParams .knownget not {//false} if .putdeviceparamsonly
/.installpagedevice cvx /rangecheck signalerror
}
ifelse pop pop
--
2.14.4