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

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