summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Resource/Init/pdf_base.ps')
-rw-r--r--Resource/Init/pdf_base.ps17
1 files changed, 12 insertions, 5 deletions
diff --git a/Resource/Init/pdf_base.ps b/Resource/Init/pdf_base.ps
index 618e5e51..2cc18270 100644
--- a/Resource/Init/pdf_base.ps
+++ b/Resource/Init/pdf_base.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2019 Artifex Software, Inc.
+% Copyright (C) 2001-2020 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -288,9 +288,11 @@ currentdict /num-chars-dict .undef
% Execute a file, like .pdfrun, for a marking context.
% This temporarily rebinds LocalResources and DefaultQstate.
/.pdfruncontext { % <resdict> <file> <opdict> .pdfruncontext -
- /.pdfrun load LocalResources DefaultQstate
- /LocalResources 7 -1 roll
- dup /ParentResources LocalResources put % save the parent LocalResources
+ /.pdfrun load LocalResources DefaultQstate % res file op .pdfrun Loc Qst
+ /LocalResources 7 -1 roll % file op .pdfrun Loc Qst /Loc res
+ dup 4 index ne { % Ensure Loc != res to avoid self-referencing /ParentResources
+ dup /ParentResources 5 index put % save the parent LocalResources
+ } if
store % store new LocalResources
/DefaultQstate qstate store
3 .execn
@@ -487,7 +489,12 @@ currentdict /token_nofail_dict .undef
} if
oforce % but dereference {1 0 R}
dup type dup /arraytype eq exch /packedarraytype eq or {
- [ exch 2 index <<>> copy exch { safe_recursive exch } forall pop]
+ [ exch {
+ counttomark 1 add index <<>> copy % create a copy for the recursion
+ exch safe_recursive exch
+ pop % pop the dictionary created for this level
+ } forall
+ ]
} {
dup type /dicttype eq {
<< exch 2 index <<>> copy exch { 3 -1 roll exch safe_recursive 3 -1 roll oforce 3 1 roll exch } forall pop>>