diff options
author | Ray Johnston <ray.johnston@artifex.com> | 2021-02-18 17:59:26 -0800 |
---|---|---|
committer | Ray Johnston <ray.johnston@artifex.com> | 2021-02-18 17:59:26 -0800 |
commit | d4c0981839bb2194040a9d15c8772e266ae235e3 (patch) | |
tree | 3182b1fbc2e095777a4697e168bc31c2972a5f52 /lib | |
parent | a32419cebfe2db81aa5e838b95e5770241a22fb1 (diff) | |
download | ghostpdl-d4c0981839bb2194040a9d15c8772e266ae235e3.tar.gz |
Fix bug 703557. Replace .sort procedure for use in SAFER mode
Thanks to Peter Cherepanov for this patch.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pdf_info.ps | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/pdf_info.ps b/lib/pdf_info.ps index 3ea2454e5..5095130c6 100644 --- a/lib/pdf_info.ps +++ b/lib/pdf_info.ps @@ -412,6 +412,28 @@ currentdict /res-type-dict undef currentdict /ProcessedResources undef } bind def +% If running with -dSAFER, .sort may not be present. Define a (slower) PS alternative +systemdict /.sort known not { +% <array> <lt-proc> .sort <array> + /.sort + { 1 index length 1 sub -1 1 + { 2 index exch 2 copy get 3 copy % arr proc arr i arr[i] arr i arr[i] + 0 1 3 index 1 sub + { 3 index 1 index get % arr proc arr i arr[i] arr imax amax j arr[j] + 2 index 1 index 10 index exec + { % ... amax < arr[j] + 4 2 roll + } + if pop pop + } + for % arr proc arr i arr[i] arr imax amax + 4 -1 roll exch 4 1 roll put put + } + for + pop + } bind def +} if + /dump-fonts-used { % <dict for fonts> dump-fonts-used - % If DumpFontsUsed is not true, then remove the 'standard' fonts from the list systemdict /DumpFontsUsed known not { |