[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1739-ga7fe4b4

[email protected] (Ray Johnston) Tue, 22 Oct 2019 14:56:29 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  a7fe4b47d438c78af0fc03adf030d465cfe0ba4f (commit)
      from  b4521b891de48d7f62be739d02749c4aeca2fde8 (commit)

----------------------------------------------------------------------
commit a7fe4b47d438c78af0fc03adf030d465cfe0ba4f
Author: Ray Johnston <[email protected]>
Date:   Mon Oct 21 15:12:57 2019 -0700

    Apply DOPS to "bare" PS operator in PDF's
    
    PDF 1.2 defined a PS operator that could be used in streams to execute
    PostScript. This went away with PDF 1.3 2nd edition spec., but Ghostscript
    retained the functionality. In commit e7086fc6 we disabled the execution
    of Subtype /PS streams (requiring -dDOPS to enable them), but the "PS"
    operator, that sends PostScript strings to the underlying Postscript
    interpreter remained unaffected, leading to Bug 700176 exploit.
    
    This patch also disables the "PS" operator unless -dDOPS is specified.
    Using -dDOPS is *NOT* recommended, although the fixes for Bug700176
    should prevent that particular exploit.

diff --git a/Resource/Init/pdf_main.ps b/Resource/Init/pdf_main.ps
index 84f90b0..09b7765 100644
--- a/Resource/Init/pdf_main.ps
+++ b/Resource/Init/pdf_main.ps
@@ -47,7 +47,7 @@ userdict /GS_PDF_ProcSet undef
         % PDF 1.1 operators
   /BX { /BXlevel BXlevel 1 add store } bind executeonly
   /EX { /BXlevel BXlevel 1 sub store } bind executeonly
-  /PS { cvx exec } bind executeonly
+  /PS { DOPS { cvx exec } { pop } ifelse } bind executeonly	% PS disabled by default, as in pdf_draw.ps DoPS
         % PDF 1.2 operators
   /BMC {
     /BMClevel BMClevel 1 add store
diff --git a/doc/Use.htm b/doc/Use.htm
index 02f95ff..a06767e 100644
--- a/doc/Use.htm
+++ b/doc/Use.htm
@@ -2561,8 +2561,10 @@ files from Corel 9 and Illustrator 88 do not operate properly if these operators
 
 <dl>
     <dt><code>-dDOPS</code></dt>
-<dd>Enables processing of DoPS directives in PDF files. DoPS has in
-fact been deprecated for some time. Use of this option is not
+<dd>Enables processing of Subtype /PS streams in PDF files and the DoPS operator.
+DoPS has in fact been deprecated for some time. Also the "PS" operator that was
+removed from the 1.3 2nd edition specification is also disabled by default, and
+enabled by <code>-dDOPS</code>. Use of this option is <b>NOT</b>
 recommended in security-conscious applications, as it increases the
 scope for malicious code. <code>-dDOPS</code> has no effect on
 processing of PostScript source files. Note: in releases 7.30 and


Summary of changes:
 Resource/Init/pdf_main.ps | 2 +-
 doc/Use.htm               | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)