|
|
bd82b2 |
commit 30cd347f37bfb293ffdc407397d1023628400b81
|
|
|
bd82b2 |
Author: Ken Sharp <ken.sharp@artifex.com>
|
|
|
bd82b2 |
Date: Mon Oct 15 13:35:15 2018 +0100
|
|
|
bd82b2 |
|
|
|
bd82b2 |
font parsing - prevent SEGV in .cffparse
|
|
|
bd82b2 |
|
|
|
bd82b2 |
Bug #699961 "currentcolortransfer procs crash .parsecff"
|
|
|
bd82b2 |
|
|
|
bd82b2 |
zparsecff checked the operand for being an array (and not a packed
|
|
|
bd82b2 |
array) but the returned procedures from the default currentcolortransfer
|
|
|
bd82b2 |
are arrays, not packed arrays. This led to the code trying to
|
|
|
bd82b2 |
dereference a NULL pointer.
|
|
|
bd82b2 |
|
|
|
bd82b2 |
Add a specific check for the 'refs' pointer being NULL before we try
|
|
|
bd82b2 |
to use it.
|
|
|
bd82b2 |
|
|
|
bd82b2 |
Additionally, make the StartData procedure in the CFF Font Resource
|
|
|
bd82b2 |
executeonly to prevent pulling the hidden .parsecff operator out and
|
|
|
bd82b2 |
using it. Finally, extend this to other resource types.
|
|
|
bd82b2 |
|
|
|
bd82b2 |
commit 8e18fcdaa2e2247363c4cc8f851f3096cc5756fa
|
|
|
bd82b2 |
Author: Chris Liddell <chris.liddell@artifex.com>
|
|
|
bd82b2 |
Date: Fri Oct 19 13:14:24 2018 +0100
|
|
|
bd82b2 |
|
|
|
bd82b2 |
"Hide" a final use of a .force* operator
|
|
|
bd82b2 |
|
|
|
bd82b2 |
There was one use of .forceput remaining that was in a regular procedure
|
|
|
bd82b2 |
rather than being "hidden" behind an operator.
|
|
|
bd82b2 |
|
|
|
bd82b2 |
In this case, it's buried in the resource machinery, and hard to access (I
|
|
|
bd82b2 |
would not be confident in claiming it was impossible). This ensures it's
|
|
|
bd82b2 |
not accessible.
|
|
|
bd82b2 |
|
|
|
bd82b2 |
From d3537a54740d78c5895ec83694a07b3e4f616f61 Mon Sep 17 00:00:00 2001
|
|
|
bd82b2 |
From: Chris Liddell <chris.liddell@artifex.com>
|
|
|
bd82b2 |
Date: Wed, 5 Dec 2018 12:22:13 +0000
|
|
|
bd82b2 |
Subject: [PATCH] Bug700317: Address .force* operators exposure
|
|
|
bd82b2 |
|
|
|
bd82b2 |
Fix logic for an older change: unlike almost every other function in gs, dict_find_string() returns 1 on
|
|
|
bd82b2 |
success 0 or <0 on failure. The logic for this case was wrong.
|
|
|
bd82b2 |
|
|
|
bd82b2 |
Sanitize op stack for error conditions
|
|
|
bd82b2 |
|
|
|
bd82b2 |
We save the stacks to an array and store the array for the error handler to
|
|
|
bd82b2 |
access.
|
|
|
bd82b2 |
|
|
|
bd82b2 |
For SAFER, we traverse the array, and deep copy any op arrays (procedures). As
|
|
|
bd82b2 |
we make these copies, we check for operators that do *not* exist in systemdict,
|
|
|
bd82b2 |
when we find one, we replace the operator with a name object (of the form
|
|
|
bd82b2 |
"/--opname--").
|
|
|
bd82b2 |
|
|
|
bd82b2 |
Any transient procedures that call .force* operators
|
|
|
bd82b2 |
|
|
|
bd82b2 |
(i.e. for conditionals or loops) make them executeonly.
|
|
|
bd82b2 |
|
|
|
bd82b2 |
Harden some uses of .force* operators
|
|
|
bd82b2 |
|
|
|
bd82b2 |
by adding a few immediate evalutions
|
|
|
bd82b2 |
|
|
|
bd82b2 |
CVE-2019-6116
|
|
|
bd82b2 |
---
|
|
|
bd82b2 |
|
|
|
bd82b2 |
diff -up ghostscript-9.07/psi/interp.c.cve-2019-6116 ghostscript-9.07/psi/interp.c
|
|
|
bd82b2 |
--- ghostscript-9.07/psi/interp.c.cve-2019-6116 2019-01-24 12:20:06.802913354 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/psi/interp.c 2019-01-24 12:20:06.843912826 +0100
|
|
|
bd82b2 |
@@ -692,7 +692,7 @@ again:
|
|
|
bd82b2 |
* i.e. it's an internal operator we have hidden
|
|
|
bd82b2 |
*/
|
|
|
bd82b2 |
code = dict_find_string(systemdict, (const char *)bufptr, &tobj);
|
|
|
bd82b2 |
- if (code < 0) {
|
|
|
bd82b2 |
+ if (code <= 0) {
|
|
|
bd82b2 |
buf[0] = buf[1] = buf[rlen + 2] = buf[rlen + 3] = '-';
|
|
|
bd82b2 |
rlen += 4;
|
|
|
bd82b2 |
bufptr = buf;
|
|
|
bd82b2 |
@@ -751,6 +751,7 @@ copy_stack(i_ctx_t *i_ctx_p, const ref_s
|
|
|
bd82b2 |
uint size = ref_stack_count(pstack) - skip;
|
|
|
bd82b2 |
uint save_space = ialloc_space(idmemory);
|
|
|
bd82b2 |
int code, i;
|
|
|
bd82b2 |
+ ref *safety, *safe;
|
|
|
bd82b2 |
|
|
|
bd82b2 |
if (size > 65535)
|
|
|
bd82b2 |
size = 65535;
|
|
|
bd82b2 |
@@ -768,6 +769,13 @@ copy_stack(i_ctx_t *i_ctx_p, const ref_s
|
|
|
bd82b2 |
make_null(&arr->value.refs[i]);
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
+ if (pstack == &o_stack && dict_find_string(systemdict, "SAFETY", &safety) > 0 &&
|
|
|
bd82b2 |
+ dict_find_string(safety, "safe", &safe) > 0 && r_has_type(safe, t_boolean) &&
|
|
|
bd82b2 |
+ safe->value.boolval == true) {
|
|
|
bd82b2 |
+ code = ref_stack_array_sanitize(i_ctx_p, arr, arr);
|
|
|
bd82b2 |
+ if (code < 0)
|
|
|
bd82b2 |
+ return code;
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
ialloc_set_space(idmemory, save_space);
|
|
|
bd82b2 |
return code;
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
diff -up ghostscript-9.07/psi/int.mak.cve-2019-6116 ghostscript-9.07/psi/int.mak
|
|
|
bd82b2 |
--- ghostscript-9.07/psi/int.mak.cve-2019-6116 2019-01-24 12:20:06.824913071 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/psi/int.mak 2019-01-24 12:20:06.843912826 +0100
|
|
|
bd82b2 |
@@ -199,7 +199,7 @@ $(PSOBJ)iparam.$(OBJ) : $(PSSRC)iparam.c
|
|
|
bd82b2 |
$(PSOBJ)istack.$(OBJ) : $(PSSRC)istack.c $(GH) $(memory__h)\
|
|
|
bd82b2 |
$(ierrors_h) $(gsstruct_h) $(gsutil_h)\
|
|
|
bd82b2 |
$(ialloc_h) $(istack_h) $(istkparm_h) $(istruct_h) $(iutil_h) $(ivmspace_h)\
|
|
|
bd82b2 |
- $(store_h)
|
|
|
bd82b2 |
+ $(store_h) $(icstate_h) $(iname_h) $(dstack_h) $(idict_h)
|
|
|
bd82b2 |
$(PSCC) $(PSO_)istack.$(OBJ) $(C_) $(PSSRC)istack.c
|
|
|
bd82b2 |
|
|
|
bd82b2 |
$(PSOBJ)iutil.$(OBJ) : $(PSSRC)iutil.c $(GH) $(math__h) $(memory__h) $(string__h)\
|
|
|
bd82b2 |
diff -up ghostscript-9.07/psi/istack.c.cve-2019-6116 ghostscript-9.07/psi/istack.c
|
|
|
bd82b2 |
--- ghostscript-9.07/psi/istack.c.cve-2019-6116 2013-02-14 08:58:13.000000000 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/psi/istack.c 2019-01-24 12:20:06.844912813 +0100
|
|
|
bd82b2 |
@@ -27,6 +27,10 @@
|
|
|
bd82b2 |
#include "iutil.h"
|
|
|
bd82b2 |
#include "ivmspace.h" /* for local/global test */
|
|
|
bd82b2 |
#include "store.h"
|
|
|
bd82b2 |
+#include "icstate.h"
|
|
|
bd82b2 |
+#include "iname.h"
|
|
|
bd82b2 |
+#include "dstack.h"
|
|
|
bd82b2 |
+#include "idict.h"
|
|
|
bd82b2 |
|
|
|
bd82b2 |
/* Forward references */
|
|
|
bd82b2 |
static void init_block(ref_stack_t *pstack, const ref *pblock_array,
|
|
|
bd82b2 |
@@ -283,6 +287,80 @@ ref_stack_store_check(const ref_stack_t
|
|
|
bd82b2 |
return 0;
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
|
|
|
bd82b2 |
+int
|
|
|
bd82b2 |
+ref_stack_array_sanitize(i_ctx_t *i_ctx_p, ref *sarr, ref *darr)
|
|
|
bd82b2 |
+{
|
|
|
bd82b2 |
+ int i, code;
|
|
|
bd82b2 |
+ ref obj, arr2;
|
|
|
bd82b2 |
+ ref *pobj2;
|
|
|
bd82b2 |
+ gs_memory_t *mem = (gs_memory_t *)idmemory->current;
|
|
|
bd82b2 |
+
|
|
|
bd82b2 |
+ if (!r_is_array(sarr) || !r_has_type(darr, t_array))
|
|
|
bd82b2 |
+ return_error(gs_error_typecheck);
|
|
|
bd82b2 |
+
|
|
|
bd82b2 |
+ for (i = 0; i < r_size(sarr); i++) {
|
|
|
bd82b2 |
+ code = array_get(mem, sarr, i, &obj);
|
|
|
bd82b2 |
+ if (code < 0)
|
|
|
bd82b2 |
+ make_null(&obj);
|
|
|
bd82b2 |
+ switch(r_type(&obj)) {
|
|
|
bd82b2 |
+ case t_operator:
|
|
|
bd82b2 |
+ {
|
|
|
bd82b2 |
+ int index = op_index(&obj);
|
|
|
bd82b2 |
+
|
|
|
bd82b2 |
+ if (index > 0 && index < op_def_count) {
|
|
|
bd82b2 |
+ const byte *data = (const byte *)(op_index_def(index)->oname + 1);
|
|
|
bd82b2 |
+ if (dict_find_string(systemdict, (const char *)data, &pobj2) <= 0) {
|
|
|
bd82b2 |
+ byte *s = gs_alloc_bytes(mem, strlen((char *)data) + 5, "ref_stack_array_sanitize");
|
|
|
bd82b2 |
+ if (s) {
|
|
|
bd82b2 |
+ s[0] = '\0';
|
|
|
bd82b2 |
+ strcpy((char *)s, "--");
|
|
|
bd82b2 |
+ strcpy((char *)s + 2, (char *)data);
|
|
|
bd82b2 |
+ strcpy((char *)s + strlen((char *)data) + 2, "--");
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ else {
|
|
|
bd82b2 |
+ s = (byte *)data;
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ code = name_ref(imemory, s, strlen((char *)s), &obj, 1);
|
|
|
bd82b2 |
+ if (code < 0) make_null(&obj);
|
|
|
bd82b2 |
+ if (s != data)
|
|
|
bd82b2 |
+ gs_free_object(mem, s, "ref_stack_array_sanitize");
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ else {
|
|
|
bd82b2 |
+ make_null(&obj);
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ ref_assign(darr->value.refs + i, &obj);
|
|
|
bd82b2 |
+ break;
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ case t_array:
|
|
|
bd82b2 |
+ case t_shortarray:
|
|
|
bd82b2 |
+ case t_mixedarray:
|
|
|
bd82b2 |
+ {
|
|
|
bd82b2 |
+ int attrs = r_type_attrs(&obj) & (a_write | a_read | a_execute | a_executable);
|
|
|
bd82b2 |
+ /* We only want to copy executable arrays */
|
|
|
bd82b2 |
+ if (attrs & (a_execute | a_executable)) {
|
|
|
bd82b2 |
+ code = ialloc_ref_array(&arr2, attrs, r_size(&obj), "ref_stack_array_sanitize");
|
|
|
bd82b2 |
+ if (code < 0) {
|
|
|
bd82b2 |
+ make_null(&arr2);
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ else {
|
|
|
bd82b2 |
+ code = ref_stack_array_sanitize(i_ctx_p, &obj, &arr2);
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ ref_assign(darr->value.refs + i, &arr2);
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ else {
|
|
|
bd82b2 |
+ ref_assign(darr->value.refs + i, &obj);
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ break;
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ default:
|
|
|
bd82b2 |
+ ref_assign(darr->value.refs + i, &obj);
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ }
|
|
|
bd82b2 |
+ return 0;
|
|
|
bd82b2 |
+}
|
|
|
bd82b2 |
+
|
|
|
bd82b2 |
+
|
|
|
bd82b2 |
/*
|
|
|
bd82b2 |
* Store the top 'count' elements of a stack, starting 'skip' elements below
|
|
|
bd82b2 |
* the top, into an array, with or without store/undo checking. age=-1 for
|
|
|
bd82b2 |
diff -up ghostscript-9.07/psi/istack.h.cve-2019-6116 ghostscript-9.07/psi/istack.h
|
|
|
bd82b2 |
--- ghostscript-9.07/psi/istack.h.cve-2019-6116 2013-02-14 08:58:13.000000000 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/psi/istack.h 2019-01-24 12:20:06.844912813 +0100
|
|
|
bd82b2 |
@@ -129,6 +129,9 @@ int ref_stack_store(const ref_stack_t *p
|
|
|
bd82b2 |
uint skip, int age, bool check,
|
|
|
bd82b2 |
gs_dual_memory_t *idmem, client_name_t cname);
|
|
|
bd82b2 |
|
|
|
bd82b2 |
+int
|
|
|
bd82b2 |
+ref_stack_array_sanitize(i_ctx_t *i_ctx_p, ref *sarr, ref *darr);
|
|
|
bd82b2 |
+
|
|
|
bd82b2 |
/*
|
|
|
bd82b2 |
* Pop the top N elements off a stack.
|
|
|
bd82b2 |
* The number must not exceed the number of elements in use.
|
|
|
bd82b2 |
diff -up ghostscript-9.07/psi/zfont2.c.cve-2019-6116 ghostscript-9.07/psi/zfont2.c
|
|
|
bd82b2 |
--- ghostscript-9.07/psi/zfont2.c.cve-2019-6116 2019-01-24 12:20:06.601915943 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/psi/zfont2.c 2019-01-24 12:20:06.844912813 +0100
|
|
|
bd82b2 |
@@ -2718,9 +2718,13 @@ zparsecff(i_ctx_t *i_ctx_p)
|
|
|
bd82b2 |
ref blk_wrap[1];
|
|
|
bd82b2 |
|
|
|
bd82b2 |
check_read(*op);
|
|
|
bd82b2 |
+
|
|
|
bd82b2 |
if (r_has_type(op, t_array)) { /* no packedarrays */
|
|
|
bd82b2 |
int i, blk_sz, blk_cnt;
|
|
|
bd82b2 |
|
|
|
bd82b2 |
+ if (op->value.refs == NULL)
|
|
|
bd82b2 |
+ return_error(gs_error_typecheck);
|
|
|
bd82b2 |
+
|
|
|
bd82b2 |
data.blk_ref = op->value.refs;
|
|
|
bd82b2 |
blk_cnt = r_size(op);
|
|
|
bd82b2 |
blk_sz = r_size(data.blk_ref);
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_cff.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_cff.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_cff.ps.cve-2019-6116 2013-02-14 08:58:16.000000000 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_cff.ps 2019-01-24 12:20:06.845912801 +0100
|
|
|
bd82b2 |
@@ -719,7 +719,7 @@ dup % Format 2
|
|
|
bd82b2 |
% ordinary CFF font.
|
|
|
bd82b2 |
/StartData { % <resname> <nbytes> StartData -
|
|
|
bd82b2 |
currentfile exch subfilefilter //false //false ReadData pop
|
|
|
bd82b2 |
-} bind def
|
|
|
bd82b2 |
+} bind executeonly def
|
|
|
bd82b2 |
/ReadData { % <resname> <file> <forceresname> <forcecid> ReadData <fontset>
|
|
|
bd82b2 |
% Initialize.
|
|
|
bd82b2 |
|
|
|
bd82b2 |
@@ -860,7 +860,7 @@ systemdict /OLDCFF known {
|
|
|
bd82b2 |
end % FontSetInit ProcSet
|
|
|
bd82b2 |
/FontSet defineresource
|
|
|
bd82b2 |
|
|
|
bd82b2 |
-} bind def
|
|
|
bd82b2 |
+} bind executeonly def
|
|
|
bd82b2 |
|
|
|
bd82b2 |
% ---------------- Resource category definition ---------------- %
|
|
|
bd82b2 |
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_cidcm.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_cidcm.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_cidcm.ps.cve-2019-6116 2013-02-14 08:58:16.000000000 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_cidcm.ps 2019-01-24 12:20:06.845912801 +0100
|
|
|
bd82b2 |
@@ -327,7 +327,7 @@ currentdict end def
|
|
|
bd82b2 |
//FindResource exec
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
-} bind def
|
|
|
bd82b2 |
+} bind executeonly def
|
|
|
bd82b2 |
|
|
|
bd82b2 |
/ResourceStatus { % <InstName> ResourceStatus <nStatus> <nSize> true
|
|
|
bd82b2 |
% <InstName> ResourceStatus false
|
|
|
bd82b2 |
@@ -359,7 +359,7 @@ currentdict end def
|
|
|
bd82b2 |
//false
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
-} bind def
|
|
|
bd82b2 |
+} bind executeonly def
|
|
|
bd82b2 |
|
|
|
bd82b2 |
/ResourceForAll { % <template> <proc> <scratch> ResourceForAll -
|
|
|
bd82b2 |
|
|
|
bd82b2 |
@@ -440,7 +440,7 @@ currentdict end def
|
|
|
bd82b2 |
|
|
|
bd82b2 |
% Make the enumerator and apply it :
|
|
|
bd82b2 |
/MappedCategoryRedefiner /ProcSet findresource /MakeResourceEnumerator get exec exec
|
|
|
bd82b2 |
-} bind def
|
|
|
bd82b2 |
+} bind executeonly def
|
|
|
bd82b2 |
|
|
|
bd82b2 |
currentdict end /Font exch /Category defineresource pop
|
|
|
bd82b2 |
end
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_ciddc.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_ciddc.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_ciddc.ps.cve-2019-6116 2013-02-14 08:58:16.000000000 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_ciddc.ps 2019-01-24 12:20:06.845912801 +0100
|
|
|
bd82b2 |
@@ -202,7 +202,7 @@ begin
|
|
|
bd82b2 |
exch pop begin %
|
|
|
bd82b2 |
.GetCIDDecoding
|
|
|
bd82b2 |
end
|
|
|
bd82b2 |
- } bind def
|
|
|
bd82b2 |
+ } bind executeonly def
|
|
|
bd82b2 |
|
|
|
bd82b2 |
/FindResource % <name> FindResource <dict>
|
|
|
bd82b2 |
{ currentglobal exch % bGlobal /InstName
|
|
|
bd82b2 |
@@ -210,7 +210,7 @@ begin
|
|
|
bd82b2 |
dup //.MakeInstance exec % bGlobal /InstName <Inst>
|
|
|
bd82b2 |
DefineResource % bGlobal <Inst>
|
|
|
bd82b2 |
exch setglobal % <Inst>
|
|
|
bd82b2 |
- } bind def
|
|
|
bd82b2 |
+ } bind executeonly def
|
|
|
bd82b2 |
|
|
|
bd82b2 |
currentdict end
|
|
|
bd82b2 |
/CIDDecoding exch /Category defineresource pop
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_cmap.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_cmap.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_cmap.ps.cve-2019-6116 2013-02-14 08:58:16.000000000 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_cmap.ps 2019-01-24 12:20:06.845912801 +0100
|
|
|
bd82b2 |
@@ -535,7 +535,7 @@ dup /DefineResource {
|
|
|
bd82b2 |
} if
|
|
|
bd82b2 |
dup /CodeMap .knownget { //null eq { .buildcmap } if } if
|
|
|
bd82b2 |
/Generic /Category findresource /DefineResource get exec
|
|
|
bd82b2 |
-} bind put
|
|
|
bd82b2 |
+} bind executeonly put
|
|
|
bd82b2 |
/Category defineresource pop
|
|
|
bd82b2 |
% We might have loaded CID font support already.
|
|
|
bd82b2 |
/CIDInit /ProcSet 2 copy { findresource } .internalstopped
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_diskn.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_diskn.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_diskn.ps.cve-2019-6116 2019-01-24 12:20:06.813913213 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_diskn.ps 2019-01-24 12:20:06.845912801 +0100
|
|
|
bd82b2 |
@@ -51,7 +51,7 @@ systemdict begin
|
|
|
bd82b2 |
mark 5 1 roll ] mark exch { { } forall } forall ]
|
|
|
bd82b2 |
//systemdict /.searchabledevs 2 index .forceput
|
|
|
bd82b2 |
exch .setglobal
|
|
|
bd82b2 |
- }
|
|
|
bd82b2 |
+ } executeonly
|
|
|
bd82b2 |
if
|
|
|
bd82b2 |
} .bind executeonly odef % must be bound and hidden for .forceput
|
|
|
bd82b2 |
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_dps1.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_dps1.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_dps1.ps.cve-2019-6116 2019-01-24 12:20:06.798913406 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_dps1.ps 2019-01-24 12:20:06.846912788 +0100
|
|
|
bd82b2 |
@@ -75,18 +75,18 @@ level2dict begin
|
|
|
bd82b2 |
} odef
|
|
|
bd82b2 |
% undefinefont has to take local/global VM into account.
|
|
|
bd82b2 |
/undefinefont % <fontname> undefinefont -
|
|
|
bd82b2 |
- { .FontDirectory 1 .argindex .forceundef % FontDirectory is readonly
|
|
|
bd82b2 |
+ { //.FontDirectory 1 .argindex .forceundef % FontDirectory is readonly
|
|
|
bd82b2 |
.currentglobal
|
|
|
bd82b2 |
{ % Current mode is global; delete from local directory too.
|
|
|
bd82b2 |
//systemdict /LocalFontDirectory .knownget
|
|
|
bd82b2 |
- { 1 index .forceundef } % LocalFontDirectory is readonly
|
|
|
bd82b2 |
+ { 1 index .forceundef } executeonly % LocalFontDirectory is readonly
|
|
|
bd82b2 |
if
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
{ % Current mode is local; if there was a shadowed global
|
|
|
bd82b2 |
% definition, copy it into the local directory.
|
|
|
bd82b2 |
//systemdict /SharedFontDirectory .knownget
|
|
|
bd82b2 |
{ 1 index .knownget
|
|
|
bd82b2 |
- { .FontDirectory 2 index 3 -1 roll { put } //superexec } % readonly
|
|
|
bd82b2 |
+ { //.FontDirectory 2 index 3 -1 roll { put } //superexec } % readonly
|
|
|
bd82b2 |
if
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
if
|
|
|
bd82b2 |
@@ -127,7 +127,7 @@ level2dict begin
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
ifelse
|
|
|
bd82b2 |
} forall
|
|
|
bd82b2 |
- pop counttomark 2 idiv { .forceundef } repeat pop % readonly
|
|
|
bd82b2 |
+ pop counttomark 2 idiv { .forceundef } executeonly repeat pop % readonly
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
if
|
|
|
bd82b2 |
//SharedFontDirectory exch .forcecopynew pop
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_dps.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_dps.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_dps.ps.cve-2019-6116 2019-01-24 12:20:06.813913213 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_dps.ps 2019-01-24 12:20:06.846912788 +0100
|
|
|
bd82b2 |
@@ -118,7 +118,7 @@
|
|
|
bd82b2 |
.dicttomark readonly /localdicts exch put
|
|
|
bd82b2 |
% localdicts is now defined in userdict.
|
|
|
bd82b2 |
% Copy the definitions into systemdict.
|
|
|
bd82b2 |
- localdicts { .forcedef } forall
|
|
|
bd82b2 |
+ localdicts { .forcedef } executeonly forall
|
|
|
bd82b2 |
% Set the user parameters.
|
|
|
bd82b2 |
userparams readonly .setuserparams
|
|
|
bd82b2 |
% Establish the initial gstate(s).
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_fntem.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_fntem.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_fntem.ps.cve-2019-6116 2019-01-24 12:20:06.807913290 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_fntem.ps 2019-01-24 12:20:06.846912788 +0100
|
|
|
bd82b2 |
@@ -425,12 +425,12 @@ currentdict end def
|
|
|
bd82b2 |
.forceput % FontInfo can be read-only.
|
|
|
bd82b2 |
pop % bool <font>
|
|
|
bd82b2 |
exit
|
|
|
bd82b2 |
- } if
|
|
|
bd82b2 |
+ } executeonly if
|
|
|
bd82b2 |
dup /FontInfo get % bool <font> <FI>
|
|
|
bd82b2 |
/GlyphNames2Unicode /Unicode /Decoding findresource
|
|
|
bd82b2 |
.forceput % FontInfo can be read-only.
|
|
|
bd82b2 |
exit
|
|
|
bd82b2 |
- } loop
|
|
|
bd82b2 |
+ } executeonly loop
|
|
|
bd82b2 |
exch setglobal
|
|
|
bd82b2 |
} .bind executeonly odef % must be bound and hidden for .forceput
|
|
|
bd82b2 |
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_fonts.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_fonts.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_fonts.ps.cve-2019-6116 2019-01-24 12:20:06.814913200 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_fonts.ps 2019-01-24 12:20:06.846912788 +0100
|
|
|
bd82b2 |
@@ -505,7 +505,7 @@ buildfontdict 3 /.buildfont3 cvx put
|
|
|
bd82b2 |
if
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
if
|
|
|
bd82b2 |
- dup .FontDirectory 4 -2 roll { .growput } //superexec % readonly
|
|
|
bd82b2 |
+ dup //.FontDirectory 4 -2 roll { .growput } //superexec % readonly
|
|
|
bd82b2 |
% If the font originated as a resource, register it.
|
|
|
bd82b2 |
currentfile .currentresourcefile eq { dup .registerfont } if
|
|
|
bd82b2 |
readonly
|
|
|
bd82b2 |
@@ -927,7 +927,7 @@ $error /SubstituteFont { } put
|
|
|
bd82b2 |
% Try to find a font using only the present contents of Fontmap.
|
|
|
bd82b2 |
/.tryfindfont { % <fontname> .tryfindfont <font> true
|
|
|
bd82b2 |
% <fontname> .tryfindfont false
|
|
|
bd82b2 |
- .FontDirectory 1 index .fontknownget
|
|
|
bd82b2 |
+ //.FontDirectory 1 index .fontknownget
|
|
|
bd82b2 |
{ % Already loaded
|
|
|
bd82b2 |
exch pop //true
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
@@ -948,7 +948,7 @@ $error /SubstituteFont { } put
|
|
|
bd82b2 |
{ % Font with a procedural definition
|
|
|
bd82b2 |
exec % The procedure will load the font.
|
|
|
bd82b2 |
% Check to make sure this really happened.
|
|
|
bd82b2 |
- .FontDirectory 1 index .knownget
|
|
|
bd82b2 |
+ //.FontDirectory 1 index .knownget
|
|
|
bd82b2 |
{ exch pop //true exit }
|
|
|
bd82b2 |
if
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
@@ -980,11 +980,11 @@ $error /SubstituteFont { } put
|
|
|
bd82b2 |
{ 2 index gcheck currentglobal
|
|
|
bd82b2 |
2 copy eq {
|
|
|
bd82b2 |
pop pop .forceput
|
|
|
bd82b2 |
- } {
|
|
|
bd82b2 |
+ } executeonly {
|
|
|
bd82b2 |
5 1 roll setglobal
|
|
|
bd82b2 |
dup length string copy
|
|
|
bd82b2 |
.forceput setglobal
|
|
|
bd82b2 |
- } ifelse
|
|
|
bd82b2 |
+ } executeonly ifelse
|
|
|
bd82b2 |
} .bind executeonly odef % must be bound and hidden for .forceput
|
|
|
bd82b2 |
|
|
|
bd82b2 |
% Attempt to load a font from a file.
|
|
|
bd82b2 |
@@ -1060,11 +1060,11 @@ $error /SubstituteFont { } put
|
|
|
bd82b2 |
% because it's different depending on language level.
|
|
|
bd82b2 |
.currentglobal exch /.setglobal .systemvar exec
|
|
|
bd82b2 |
% Remove the fake definition, if any.
|
|
|
bd82b2 |
- .FontDirectory 3 index .forceundef % readonly
|
|
|
bd82b2 |
- 1 index (r) file .loadfont .FontDirectory exch
|
|
|
bd82b2 |
+ //.FontDirectory 3 index .forceundef % readonly
|
|
|
bd82b2 |
+ 1 index (r) file .loadfont //.FontDirectory exch
|
|
|
bd82b2 |
/.setglobal .systemvar exec
|
|
|
bd82b2 |
- }
|
|
|
bd82b2 |
- { .loadfont .FontDirectory
|
|
|
bd82b2 |
+ } executeonly
|
|
|
bd82b2 |
+ { .loadfont //.FontDirectory
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
ifelse
|
|
|
bd82b2 |
% Stack: fontname fontfilename fontdirectory
|
|
|
bd82b2 |
@@ -1084,7 +1084,7 @@ $error /SubstituteFont { } put
|
|
|
bd82b2 |
dup 3 index .fontknownget
|
|
|
bd82b2 |
{ dup /PathLoad 4 index //.putgstringcopy
|
|
|
bd82b2 |
4 1 roll pop pop pop //true exit
|
|
|
bd82b2 |
- } if
|
|
|
bd82b2 |
+ } executeonly if
|
|
|
bd82b2 |
|
|
|
bd82b2 |
% Maybe the file had a different FontName.
|
|
|
bd82b2 |
% See if we can get a FontName from the file, and if so,
|
|
|
bd82b2 |
@@ -1108,9 +1108,9 @@ $error /SubstituteFont { } put
|
|
|
bd82b2 |
ifelse % Stack: origfontname fontdict
|
|
|
bd82b2 |
exch pop //true exit
|
|
|
bd82b2 |
% Stack: fontdict
|
|
|
bd82b2 |
- }
|
|
|
bd82b2 |
+ } executeonly
|
|
|
bd82b2 |
if pop % Stack: origfontname fontdirectory path
|
|
|
bd82b2 |
- }
|
|
|
bd82b2 |
+ } executeonly
|
|
|
bd82b2 |
if pop pop % Stack: origfontname
|
|
|
bd82b2 |
|
|
|
bd82b2 |
% The font definitely did not load correctly.
|
|
|
bd82b2 |
@@ -1146,10 +1146,10 @@ currentdict /.putgstringcopy .forceundef
|
|
|
bd82b2 |
(gs_fonts FAKEFONTS) VMDEBUG
|
|
|
bd82b2 |
Fontmap {
|
|
|
bd82b2 |
pop dup type /stringtype eq { cvn } if
|
|
|
bd82b2 |
- .FontDirectory 1 index known not {
|
|
|
bd82b2 |
+ //.FontDirectory 1 index known not {
|
|
|
bd82b2 |
2 dict dup /FontName 3 index put
|
|
|
bd82b2 |
dup /FontType 1 put
|
|
|
bd82b2 |
- .FontDirectory 3 1 roll { put } //superexec % readonly
|
|
|
bd82b2 |
+ //.FontDirectory 3 1 roll { put } //superexec % readonly
|
|
|
bd82b2 |
} {
|
|
|
bd82b2 |
pop
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_init.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_init.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_init.ps.cve-2019-6116 2019-01-24 12:20:06.826913045 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_init.ps 2019-01-24 12:20:06.846912788 +0100
|
|
|
bd82b2 |
@@ -1157,8 +1157,8 @@ errordict /unknownerror .undef
|
|
|
bd82b2 |
//.SAFERERRORLIST
|
|
|
bd82b2 |
{dup errordict exch get 2 index 3 1 roll put} forall
|
|
|
bd82b2 |
noaccess pop
|
|
|
bd82b2 |
- systemdict /.setsafeerrors .forceundef
|
|
|
bd82b2 |
- systemdict /.SAFERERRORLIST .forceundef
|
|
|
bd82b2 |
+ //systemdict /.setsafeerrors .forceundef
|
|
|
bd82b2 |
+ //systemdict /.SAFERERRORLIST .forceundef
|
|
|
bd82b2 |
} bind executeonly odef
|
|
|
bd82b2 |
|
|
|
bd82b2 |
SAFERERRORS {.setsafererrors} if
|
|
|
bd82b2 |
@@ -2080,7 +2080,7 @@ readonly def
|
|
|
bd82b2 |
/LockFilePermissions //true
|
|
|
bd82b2 |
>> setuserparams
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
- systemdict /getenv {pop //false} .forceput
|
|
|
bd82b2 |
+ //systemdict /getenv {pop //false} .forceput
|
|
|
bd82b2 |
if
|
|
|
bd82b2 |
% setpagedevice has the side effect of clearing the page, but
|
|
|
bd82b2 |
% we will just document that. Using setpagedevice keeps the device
|
|
|
bd82b2 |
@@ -2287,7 +2287,7 @@ SAFER { .setsafe } if
|
|
|
bd82b2 |
% Update the copy of the user parameters.
|
|
|
bd82b2 |
mark .currentuserparams counttomark 2 idiv {
|
|
|
bd82b2 |
userparams 3 1 roll .forceput % userparams is read-only
|
|
|
bd82b2 |
- } repeat pop
|
|
|
bd82b2 |
+ } executeonly repeat pop
|
|
|
bd82b2 |
% Turn on idiom recognition, if available.
|
|
|
bd82b2 |
currentuserparams /IdiomRecognition known {
|
|
|
bd82b2 |
/IdiomRecognition //true .definepsuserparam
|
|
|
bd82b2 |
@@ -2306,7 +2306,7 @@ SAFER { .setsafe } if
|
|
|
bd82b2 |
% Remove real system params from pssystemparams.
|
|
|
bd82b2 |
mark .currentsystemparams counttomark 2 idiv {
|
|
|
bd82b2 |
pop pssystemparams exch .forceundef
|
|
|
bd82b2 |
- } repeat pop
|
|
|
bd82b2 |
+ } executeonly repeat pop
|
|
|
bd82b2 |
} if
|
|
|
bd82b2 |
|
|
|
bd82b2 |
% Set up AlignToPixels :
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_lev2.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_lev2.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_lev2.ps.cve-2019-6116 2019-01-24 12:20:06.808913277 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_lev2.ps 2019-01-24 12:20:06.854912684 +0100
|
|
|
bd82b2 |
@@ -154,7 +154,8 @@ end
|
|
|
bd82b2 |
% protect top level of parameters that we copied
|
|
|
bd82b2 |
dup type dup /arraytype eq exch /stringtype eq or { readonly } if
|
|
|
bd82b2 |
/userparams .systemvar 3 1 roll .forceput % userparams is read-only
|
|
|
bd82b2 |
- } {
|
|
|
bd82b2 |
+ } executeonly
|
|
|
bd82b2 |
+ {
|
|
|
bd82b2 |
pop pop
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
} forall
|
|
|
bd82b2 |
@@ -223,7 +224,7 @@ end
|
|
|
bd82b2 |
% protect top level parameters that we copied
|
|
|
bd82b2 |
dup type dup /arraytype eq exch /stringtype eq or { readonly } if
|
|
|
bd82b2 |
//pssystemparams 3 1 roll .forceput % pssystemparams is read-only
|
|
|
bd82b2 |
- }
|
|
|
bd82b2 |
+ } executeonly
|
|
|
bd82b2 |
{ pop pop
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
ifelse
|
|
|
bd82b2 |
@@ -911,7 +912,7 @@ mark
|
|
|
bd82b2 |
dup /PaintProc get
|
|
|
bd82b2 |
1 index /Implementation known not {
|
|
|
bd82b2 |
1 index dup /Implementation //null .forceput readonly pop
|
|
|
bd82b2 |
- } if
|
|
|
bd82b2 |
+ } executeonly if
|
|
|
bd82b2 |
exec
|
|
|
bd82b2 |
} .bind odef % must bind .forceput
|
|
|
bd82b2 |
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_pdfwr.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_pdfwr.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_pdfwr.ps.cve-2019-6116 2019-01-24 12:20:06.808913277 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_pdfwr.ps 2019-01-24 12:20:06.855912672 +0100
|
|
|
bd82b2 |
@@ -541,7 +541,7 @@ currentdict /.pdfmarkparams .undef
|
|
|
bd82b2 |
resourcestatus
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
} bind .makeoperator .forceput
|
|
|
bd82b2 |
- } if
|
|
|
bd82b2 |
+ } executeonly if
|
|
|
bd82b2 |
pop
|
|
|
bd82b2 |
} if
|
|
|
bd82b2 |
} {
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_res.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_res.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_res.ps.cve-2019-6116 2013-02-14 08:58:16.000000000 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_res.ps 2019-01-24 12:20:06.857912646 +0100
|
|
|
bd82b2 |
@@ -155,10 +155,10 @@ setglobal
|
|
|
bd82b2 |
} {
|
|
|
bd82b2 |
/defineresource cvx /typecheck signaloperror
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
-} bind def
|
|
|
bd82b2 |
+} bind executeonly odef
|
|
|
bd82b2 |
/FindResource % (redefined below)
|
|
|
bd82b2 |
{ .Instances exch get 0 get
|
|
|
bd82b2 |
- } bind def
|
|
|
bd82b2 |
+ } bind executeonly def
|
|
|
bd82b2 |
|
|
|
bd82b2 |
% Additional entries
|
|
|
bd82b2 |
|
|
|
bd82b2 |
@@ -210,7 +210,7 @@ def
|
|
|
bd82b2 |
/findresource .systemvar /typecheck signalerror
|
|
|
bd82b2 |
} if
|
|
|
bd82b2 |
/findresource cvx //.findresource .errorexec
|
|
|
bd82b2 |
-} odef
|
|
|
bd82b2 |
+} bind executeonly odef
|
|
|
bd82b2 |
|
|
|
bd82b2 |
/defineresource { % <key> <instance> <category> defineresource <instance>
|
|
|
bd82b2 |
2 .argindex 2 index 2 index % catch stackunderflow
|
|
|
bd82b2 |
@@ -226,7 +226,7 @@ def
|
|
|
bd82b2 |
/DefineResource .resourceexec
|
|
|
bd82b2 |
4 1 roll pop pop pop
|
|
|
bd82b2 |
} .errorexec
|
|
|
bd82b2 |
-} bind odef
|
|
|
bd82b2 |
+} bind executeonly odef
|
|
|
bd82b2 |
% We must prevent resourceforall from automatically restoring the stacks,
|
|
|
bd82b2 |
% because we don't want the stacks restored if proc causes an error or
|
|
|
bd82b2 |
% executes a 'stop'. On the other hand, resourceforall is defined in the
|
|
|
bd82b2 |
@@ -240,10 +240,10 @@ def
|
|
|
bd82b2 |
% Stack: <template> <proc> <scratch> <category> proc
|
|
|
bd82b2 |
exch pop % pop the category
|
|
|
bd82b2 |
exec end
|
|
|
bd82b2 |
-} bind def
|
|
|
bd82b2 |
+} bind executeonly def
|
|
|
bd82b2 |
/resourceforall { % <template> <proc> <scratch> <category> resourceforall1 -
|
|
|
bd82b2 |
//resourceforall1 exec % see above
|
|
|
bd82b2 |
-} bind odef
|
|
|
bd82b2 |
+} bind executeonly odef
|
|
|
bd82b2 |
/resourcestatus { % <key> <category> resourcestatus <status> <size> true
|
|
|
bd82b2 |
% <key> <category> resourcestatus false
|
|
|
bd82b2 |
{
|
|
|
bd82b2 |
@@ -259,7 +259,7 @@ def
|
|
|
bd82b2 |
% for error reporting. CET 23-26
|
|
|
bd82b2 |
/resourcestatus cvx $error /errorname get signalerror
|
|
|
bd82b2 |
} if
|
|
|
bd82b2 |
-} bind odef
|
|
|
bd82b2 |
+} bind executeonly odef
|
|
|
bd82b2 |
/undefineresource { % <key> <category> undefineresource -
|
|
|
bd82b2 |
0 .argindex type /nametype ne {
|
|
|
bd82b2 |
/undefinedresource cvx /typecheck signaloperror
|
|
|
bd82b2 |
@@ -272,7 +272,7 @@ def
|
|
|
bd82b2 |
% here but uses operator for the errors above. CET 23-33
|
|
|
bd82b2 |
/undefineresource cvx $error /errorname get signalerror
|
|
|
bd82b2 |
} if
|
|
|
bd82b2 |
-} bind odef
|
|
|
bd82b2 |
+} bind executeonly odef
|
|
|
bd82b2 |
|
|
|
bd82b2 |
% Define the system parameters used for the Generic implementation of
|
|
|
bd82b2 |
% ResourceFileName.
|
|
|
bd82b2 |
@@ -412,7 +412,7 @@ status {
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
} bind def
|
|
|
bd82b2 |
|
|
|
bd82b2 |
-/DefineResource {
|
|
|
bd82b2 |
+/DefineResource dup {
|
|
|
bd82b2 |
.CheckResource
|
|
|
bd82b2 |
{ dup [ exch 0 -1 ]
|
|
|
bd82b2 |
% Stack: key value instance
|
|
|
bd82b2 |
@@ -424,7 +424,7 @@ status {
|
|
|
bd82b2 |
% As noted above, Category dictionaries are read-only,
|
|
|
bd82b2 |
% so we have to use .forcedef here.
|
|
|
bd82b2 |
/.Instances 1 index .forcedef % Category dict is read-only
|
|
|
bd82b2 |
- } if
|
|
|
bd82b2 |
+ } executeonly if
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
{ .LocalInstances dup //.emptydict eq
|
|
|
bd82b2 |
{ pop 3 dict localinstancedict Category 2 index put
|
|
|
bd82b2 |
@@ -441,7 +441,7 @@ status {
|
|
|
bd82b2 |
{ /defineresource cvx /typecheck signaloperror
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
ifelse
|
|
|
bd82b2 |
-} .bind executeonly % executeonly to prevent access to .forcedef
|
|
|
bd82b2 |
+} .bind executeonly .makeoperator % executeonly to prevent access to .forcedef
|
|
|
bd82b2 |
/UndefineResource
|
|
|
bd82b2 |
{ { dup 2 index .knownget
|
|
|
bd82b2 |
{ dup 1 get 1 ge
|
|
|
bd82b2 |
@@ -457,7 +457,7 @@ status {
|
|
|
bd82b2 |
{ 2 copy .Instances exch exec
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
if .LocalInstances exch exec
|
|
|
bd82b2 |
- } bind
|
|
|
bd82b2 |
+ } bind executeonly
|
|
|
bd82b2 |
% Because of some badly designed code in Adobe's CID font downloader that
|
|
|
bd82b2 |
% makes findresource and resourcestatus deliberately inconsistent with each
|
|
|
bd82b2 |
% other, the default FindResource must not call ResourceStatus if there is
|
|
|
bd82b2 |
@@ -483,7 +483,7 @@ status {
|
|
|
bd82b2 |
/findresource cvx .undefinedresource
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
-} bind
|
|
|
bd82b2 |
+} bind executeonly
|
|
|
bd82b2 |
% Because of some badly designed code in Adobe's CID font downloader, the
|
|
|
bd82b2 |
% definition of ResourceStatus for Generic and Font must be the same (!).
|
|
|
bd82b2 |
% We patch around this by using an intermediate .ResourceFileStatus procedure.
|
|
|
bd82b2 |
@@ -493,10 +493,10 @@ status {
|
|
|
bd82b2 |
} {
|
|
|
bd82b2 |
.ResourceFileStatus
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
-} bind
|
|
|
bd82b2 |
+} bind executeonly
|
|
|
bd82b2 |
/.ResourceFileStatus {
|
|
|
bd82b2 |
.ResourceFile { closefile 2 -1 //true } { pop //false } ifelse
|
|
|
bd82b2 |
-} bind
|
|
|
bd82b2 |
+} bind executeonly
|
|
|
bd82b2 |
/ResourceForAll {
|
|
|
bd82b2 |
% Construct a new procedure to hold the arguments.
|
|
|
bd82b2 |
% All objects constructed here must be in local VM to avoid
|
|
|
bd82b2 |
@@ -554,7 +554,7 @@ status {
|
|
|
bd82b2 |
3 2 roll pop % args
|
|
|
bd82b2 |
{ forall } 0 get
|
|
|
bd82b2 |
currentdict end 2 .execn begin
|
|
|
bd82b2 |
-} bind
|
|
|
bd82b2 |
+} bind executeonly
|
|
|
bd82b2 |
|
|
|
bd82b2 |
/ResourceFileName { % /in (scr) --> (p/c/n)
|
|
|
bd82b2 |
exch //.rfnstring cvs % (scr) (n)
|
|
|
bd82b2 |
@@ -577,7 +577,7 @@ status {
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
exch copy % (p/c/n)
|
|
|
bd82b2 |
-} bind
|
|
|
bd82b2 |
+} bind executeonly
|
|
|
bd82b2 |
|
|
|
bd82b2 |
% Additional entries
|
|
|
bd82b2 |
|
|
|
bd82b2 |
@@ -743,17 +743,17 @@ counttomark 2 idiv
|
|
|
bd82b2 |
ifelse
|
|
|
bd82b2 |
}
|
|
|
bd82b2 |
ifelse
|
|
|
bd82b2 |
- } bind
|
|
|
bd82b2 |
+ } bind executeonly
|
|
|
bd82b2 |
/UndefineResource
|
|
|
bd82b2 |
- { /undefineresource cvx /invalidaccess signaloperror } bind
|
|
|
bd82b2 |
+ { /undefineresource cvx /invalidaccess signaloperror } bind executeonly
|
|
|
bd82b2 |
/FindResource
|
|
|
bd82b2 |
{ .Instances 1 index .knownget
|
|
|
bd82b2 |
{ exch pop }
|
|
|
bd82b2 |
{ /findresource cvx .undefinedresource }
|
|
|
bd82b2 |
ifelse
|
|
|
bd82b2 |
- } bind
|
|
|
bd82b2 |
+ } bind executeonly
|
|
|
bd82b2 |
/ResourceStatus
|
|
|
bd82b2 |
- { .Instances exch known { 0 0 //true } { //false } ifelse } bind
|
|
|
bd82b2 |
+ { .Instances exch known { 0 0 //true } { //false } ifelse } bind executeonly
|
|
|
bd82b2 |
/ResourceForAll
|
|
|
bd82b2 |
/Generic .findcategory /ResourceForAll load end
|
|
|
bd82b2 |
|
|
|
bd82b2 |
@@ -836,7 +836,7 @@ userdict /.localcsdefaults //false put
|
|
|
bd82b2 |
1 index .definedefaultcs
|
|
|
bd82b2 |
currentglobal not { .userdict /.localcsdefaults //true put } if
|
|
|
bd82b2 |
} if
|
|
|
bd82b2 |
-} bind
|
|
|
bd82b2 |
+} bind executeonly
|
|
|
bd82b2 |
|
|
|
bd82b2 |
/UndefineResource {
|
|
|
bd82b2 |
dup /Generic /Category findresource /UndefineResource get exec
|
|
|
bd82b2 |
@@ -859,7 +859,7 @@ userdict /.localcsdefaults //false put
|
|
|
bd82b2 |
} {
|
|
|
bd82b2 |
pop
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
-} bind
|
|
|
bd82b2 |
+} bind executeonly
|
|
|
bd82b2 |
|
|
|
bd82b2 |
.definecategory % ColorSpace
|
|
|
bd82b2 |
|
|
|
bd82b2 |
@@ -889,7 +889,7 @@ userdict /.localcsdefaults //false put
|
|
|
bd82b2 |
{ exch copy exch pop }
|
|
|
bd82b2 |
{ /Generic /Category findresource /ResourceFileName get exec }
|
|
|
bd82b2 |
ifelse
|
|
|
bd82b2 |
- } bind
|
|
|
bd82b2 |
+ } bind executeonly
|
|
|
bd82b2 |
|
|
|
bd82b2 |
.definecategory % Encoding
|
|
|
bd82b2 |
|
|
|
bd82b2 |
@@ -945,11 +945,11 @@ userdict /.localcsdefaults //false put
|
|
|
bd82b2 |
/DefineResource
|
|
|
bd82b2 |
{ 2 copy //definefont exch pop
|
|
|
bd82b2 |
/Generic /Category findresource /DefineResource get exec
|
|
|
bd82b2 |
- } bind
|
|
|
bd82b2 |
+ } bind executeonly
|
|
|
bd82b2 |
/UndefineResource
|
|
|
bd82b2 |
{ dup //undefinefont
|
|
|
bd82b2 |
/Generic /Category findresource /UndefineResource get exec
|
|
|
bd82b2 |
- } bind
|
|
|
bd82b2 |
+ } bind executeonly
|
|
|
bd82b2 |
/FindResource {
|
|
|
bd82b2 |
dup .getvminstance {
|
|
|
bd82b2 |
exch pop 0 get
|
|
|
bd82b2 |
@@ -960,14 +960,14 @@ userdict /.localcsdefaults //false put
|
|
|
bd82b2 |
.loadfontresource
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
} ifelse
|
|
|
bd82b2 |
-} bind
|
|
|
bd82b2 |
+} bind executeonly
|
|
|
bd82b2 |
/ResourceForAll {
|
|
|
bd82b2 |
{ .scannextfontdir not { exit } if } loop
|
|
|
bd82b2 |
/Generic /Category findresource /ResourceForAll get exec
|
|
|
bd82b2 |
-} bind
|
|
|
bd82b2 |
+} bind executeonly
|
|
|
bd82b2 |
/.ResourceFileStatus {
|
|
|
bd82b2 |
.fontstatus { pop 2 -1 //true } { pop //false } ifelse
|
|
|
bd82b2 |
-} bind
|
|
|
bd82b2 |
+} bind executeonly
|
|
|
bd82b2 |
|
|
|
bd82b2 |
/.loadfontresource {
|
|
|
bd82b2 |
dup .vmused exch
|
|
|
bd82b2 |
@@ -1017,20 +1017,20 @@ end
|
|
|
bd82b2 |
{ /Font defineresource } stopped {
|
|
|
bd82b2 |
/definefont cvx $error /errorname get signalerror
|
|
|
bd82b2 |
} if
|
|
|
bd82b2 |
-} bind odef
|
|
|
bd82b2 |
+} bind executeonly odef
|
|
|
bd82b2 |
/undefinefont {
|
|
|
bd82b2 |
/Font undefineresource
|
|
|
bd82b2 |
-} bind odef
|
|
|
bd82b2 |
+} bind executeonly odef
|
|
|
bd82b2 |
% The Red Book requires that findfont be a procedure, not an operator,
|
|
|
bd82b2 |
% but it still needs to restore the stacks reliably if it fails.
|
|
|
bd82b2 |
/.findfontop {
|
|
|
bd82b2 |
{ /Font findresource } stopped {
|
|
|
bd82b2 |
pop /findfont $error /errorname get signalerror
|
|
|
bd82b2 |
} if
|
|
|
bd82b2 |
-} bind odef
|
|
|
bd82b2 |
+} bind executeonly odef
|
|
|
bd82b2 |
/findfont {
|
|
|
bd82b2 |
.findfontop
|
|
|
bd82b2 |
-} bind def % Must be a procedure, not an operator
|
|
|
bd82b2 |
+} bind executeonly def % Must be a procedure, not an operator
|
|
|
bd82b2 |
|
|
|
bd82b2 |
% Remove initialization utilities.
|
|
|
bd82b2 |
currentdict /.definecategory .undef
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/gs_setpd.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/gs_setpd.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/gs_setpd.ps.cve-2019-6116 2019-01-24 12:20:06.815913187 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/gs_setpd.ps 2019-01-24 12:20:06.856912659 +0100
|
|
|
bd82b2 |
@@ -570,7 +570,7 @@ NOMEDIAATTRS {
|
|
|
bd82b2 |
SETPDDEBUG { (Rolling back.) = pstack flush } if
|
|
|
bd82b2 |
3 index 2 index 3 -1 roll .forceput
|
|
|
bd82b2 |
4 index 1 index .knownget
|
|
|
bd82b2 |
- { 4 index 3 1 roll .forceput }
|
|
|
bd82b2 |
+ { 4 index 3 1 roll .forceput } executeonly
|
|
|
bd82b2 |
{ 3 index exch .undef }
|
|
|
bd82b2 |
ifelse
|
|
|
bd82b2 |
} bind executeonly odef
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/pdf_base.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/pdf_base.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/pdf_base.ps.cve-2019-6116 2019-01-24 12:20:06.809913264 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/pdf_base.ps 2019-01-24 12:20:06.856912659 +0100
|
|
|
bd82b2 |
@@ -125,26 +125,26 @@ currentdict /num-chars-dict .undef
|
|
|
bd82b2 |
|
|
|
bd82b2 |
/.pdfexectoken { % <count> <opdict> <exectoken> .pdfexectoken ?
|
|
|
bd82b2 |
PDFDEBUG {
|
|
|
bd82b2 |
- pdfdict /PDFSTEPcount known not { pdfdict /PDFSTEPcount 1 .forceput } if
|
|
|
bd82b2 |
+ pdfdict /PDFSTEPcount known not { pdfdict /PDFSTEPcount 1 .forceput } executeonly if
|
|
|
bd82b2 |
PDFSTEP {
|
|
|
bd82b2 |
pdfdict /PDFtokencount 2 copy .knownget { 1 add } { 1 } ifelse .forceput
|
|
|
bd82b2 |
PDFSTEPcount 1 gt {
|
|
|
bd82b2 |
pdfdict /PDFSTEPcount PDFSTEPcount 1 sub .forceput
|
|
|
bd82b2 |
- } {
|
|
|
bd82b2 |
+ } executeonly {
|
|
|
bd82b2 |
dup ==only
|
|
|
bd82b2 |
( step # ) print PDFtokencount =only
|
|
|
bd82b2 |
( ? ) print flush 1 //false .outputpage
|
|
|
bd82b2 |
(%stdin) (r) file 255 string readline {
|
|
|
bd82b2 |
token {
|
|
|
bd82b2 |
exch pop pdfdict /PDFSTEPcount 3 -1 roll .forceput
|
|
|
bd82b2 |
- } {
|
|
|
bd82b2 |
+ } executeonly {
|
|
|
bd82b2 |
pdfdict /PDFSTEPcount 1 .forceput
|
|
|
bd82b2 |
- } ifelse % token
|
|
|
bd82b2 |
+ } executeonly ifelse % token
|
|
|
bd82b2 |
} {
|
|
|
bd82b2 |
pop /PDFSTEP //false def % EOF on stdin
|
|
|
bd82b2 |
} ifelse % readline
|
|
|
bd82b2 |
} ifelse % PDFSTEPcount > 1
|
|
|
bd82b2 |
- } {
|
|
|
bd82b2 |
+ } executeonly {
|
|
|
bd82b2 |
dup ==only () = flush
|
|
|
bd82b2 |
} ifelse % PDFSTEP
|
|
|
bd82b2 |
} if % PDFDEBUG
|
|
|
bd82b2 |
diff -up ghostscript-9.07/Resource/Init/pdf_font.ps.cve-2019-6116 ghostscript-9.07/Resource/Init/pdf_font.ps
|
|
|
bd82b2 |
--- ghostscript-9.07/Resource/Init/pdf_font.ps.cve-2019-6116 2019-01-24 12:20:06.810913251 +0100
|
|
|
bd82b2 |
+++ ghostscript-9.07/Resource/Init/pdf_font.ps 2019-01-24 12:20:06.857912646 +0100
|
|
|
bd82b2 |
@@ -614,7 +614,7 @@ currentdict end readonly def
|
|
|
bd82b2 |
currentglobal 2 index dup gcheck setglobal
|
|
|
bd82b2 |
/FontInfo 5 dict dup 5 1 roll .forceput
|
|
|
bd82b2 |
setglobal
|
|
|
bd82b2 |
- } if
|
|
|
bd82b2 |
+ } executeonly if
|
|
|
bd82b2 |
dup /GlyphNames2Unicode .knownget not {
|
|
|
bd82b2 |
//true % No existing G2U, make one
|
|
|
bd82b2 |
} {
|
|
|
bd82b2 |
@@ -628,7 +628,7 @@ currentdict end readonly def
|
|
|
bd82b2 |
currentglobal exch dup gcheck setglobal
|
|
|
bd82b2 |
dup /GlyphNames2Unicode 100 dict dup 4 1 roll .forceput
|
|
|
bd82b2 |
3 2 roll setglobal
|
|
|
bd82b2 |
- } if % font-res font-dict encoding|null font-info g2u
|
|
|
bd82b2 |
+ } executeonly if % font-res font-dict encoding|null font-info g2u
|
|
|
bd82b2 |
exch pop exch % font-res font-dict g2u encoding|null
|
|
|
bd82b2 |
userdict /.lastToUnicode get % font-res font-dict g2u Encoding|null CMap
|
|
|
bd82b2 |
.convert_ToUnicode-into-g2u % font-res font-dict
|
|
|
bd82b2 |
@@ -1757,7 +1757,7 @@ currentdict /CMap_read_dict undef
|
|
|
bd82b2 |
/CIDFallBack /CIDFont findresource
|
|
|
bd82b2 |
} if
|
|
|
bd82b2 |
exit
|
|
|
bd82b2 |
- } if
|
|
|
bd82b2 |
+ } executeonly if
|
|
|
bd82b2 |
} if
|
|
|
bd82b2 |
} if
|
|
|
bd82b2 |
|