diff options
author | Ray Johnston <ray.johnston@artifex.com> | 2018-09-21 11:16:18 -0700 |
---|---|---|
committer | Ray Johnston <ray.johnston@artifex.com> | 2018-09-24 20:31:08 -0700 |
commit | 95aa78beae9489d5c9f898fe2032aa23f860867d (patch) | |
tree | 105a771c3d9128ee3e2ccdc61a0150154f4b381f /Resource/Init/gs_statd.ps | |
parent | 863b370ba7d791720b97ae10deb211fde8bdbd0a (diff) | |
download | ghostpdl-95aa78beae9489d5c9f898fe2032aa23f860867d.tar.gz |
Catch errors in setpagesize, .setpagesize and setpagedevice and cleanup
Bug 699794 showed that attempt to change page size in SAFER mode when the
nulldevice was the currentdevice would leave 'false' on the stack. Run
.setdevice in stopped and clean up, and also clean up .setpagesize
Diffstat (limited to 'Resource/Init/gs_statd.ps')
-rw-r--r-- | Resource/Init/gs_statd.ps | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Resource/Init/gs_statd.ps b/Resource/Init/gs_statd.ps index 64c6463d1..34b759c0f 100644 --- a/Resource/Init/gs_statd.ps +++ b/Resource/Init/gs_statd.ps @@ -39,7 +39,13 @@ statusdict begin % These procedures are also accessed as data structures during initialization, % so the page dimensions must be the first two elements of the procedure. -/.setpagesize { /statusdict .systemvar begin .setpagesize end } bind def +/.setpagesize { + /statusdict .systemvar begin + { .setpagesize } stopped { + /setpagesize $error /errorname get signalerror + } if + end +} bind def % Page sizes defined by Adobe documentation % Note: these executable arrays should all begin with two @@ -261,9 +267,17 @@ readonly def % The Adobe documentation only defines setpagetype % (a Level 1 operator) as accepting the values 0 and 1, % so we do too. - {/letter /note} 1 index get - //systemdict /userdict get exch get cvx exec - /pagetype exch def + dup type /integertype ne { + /setpage /typecheck signalerror + } { + dup 0 ne 1 index 1 ne or { + /setpage /rangecheck signalerror + } { + {/letter /note} 1 index get + //systemdict /userdict get exch get cvx exec + } ifelse + /pagetype exch def + } ifelse end } bind def |