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

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