Blame SOURCES/ghostscript-cve-2019-14811-14812-14813.patch

bf7f78
From 885444fcbe10dc42787ecb76686c8ee4dd33bf33 Mon Sep 17 00:00:00 2001
bf7f78
From: Ken Sharp <ken.sharp@artifex.com>
bf7f78
Date: Tue, 20 Aug 2019 10:10:28 +0100
bf7f78
Subject: make .forceput inaccessible
bf7f78
bf7f78
Bug #701343, #701344, #701345
bf7f78
bf7f78
More defensive programming. We don't want people to access .forecput
bf7f78
even though it is no longer sufficient to bypass SAFER. The exploit
bf7f78
in #701343 didn't work anyway because of earlier work to stop the error
bf7f78
handler being used, but nevertheless, prevent access to .forceput from
bf7f78
.setuserparams2.
bf7f78
bf7f78
diff --git a/Resource/Init/gs_lev2.ps b/Resource/Init/gs_lev2.ps
bf7f78
index 4cc7f820f..0fd416465 100644
bf7f78
--- a/Resource/Init/gs_lev2.ps
bf7f78
+++ b/Resource/Init/gs_lev2.ps
bf7f78
@@ -158,7 +158,7 @@ end
bf7f78
     {
bf7f78
       pop pop
bf7f78
     } ifelse
bf7f78
-  } forall
bf7f78
+  } executeonly forall
bf7f78
         % A context switch might have occurred during the above loop,
bf7f78
         % causing the interpreter-level parameters to be reset.
bf7f78
         % Set them again to the new values.  From here on, we are safe,
bf7f78
@@ -229,9 +229,9 @@ end
bf7f78
        { pop pop
bf7f78
        }
bf7f78
       ifelse
bf7f78
-    }
bf7f78
+    } executeonly
bf7f78
    forall pop
bf7f78
-} .bind odef
bf7f78
+} .bind executeonly odef
bf7f78
 
bf7f78
 % Initialize the passwords.
bf7f78
 % NOTE: the names StartJobPassword and SystemParamsPassword are known to
bf7f78
diff --git a/Resource/Init/gs_pdfwr.ps b/Resource/Init/gs_pdfwr.ps
bf7f78
index c158a8faf..422e66e1a 100644
bf7f78
--- a/Resource/Init/gs_pdfwr.ps
bf7f78
+++ b/Resource/Init/gs_pdfwr.ps
bf7f78
@@ -658,11 +658,11 @@ currentdict /.pdfmarkparams .undef
bf7f78
           systemdict /.pdf_hooked_DSC_Creator //true .forceput
bf7f78
         } executeonly if
bf7f78
         pop
bf7f78
-      } if
bf7f78
+      } executeonly if
bf7f78
     } {
bf7f78
       pop
bf7f78
     } ifelse
bf7f78
-  }
bf7f78
+  } executeonly
bf7f78
   {
bf7f78
     pop
bf7f78
   } ifelse