Blame SOURCES/ghostscript-cve-2018-15910.patch

ea5d11
From ebcbe0d685911ffc95f3584f6fcbf1f695959757 Mon Sep 17 00:00:00 2001
ea5d11
From: Chris Liddell <chris.liddell@artifex.com>
ea5d11
Date: Tue, 21 Aug 2018 16:42:45 +0100
ea5d11
Subject: [PATCH] Bug 699656: Handle LockDistillerParams not being a boolean
ea5d11
ea5d11
This caused a function call commented as "Can't fail" to fail, and resulted
ea5d11
in memory correuption and a segfault.
ea5d11
---
ea5d11
 base/gdevpdfp.c | 2 +-
ea5d11
 psi/iparam.c    | 7 ++++---
ea5d11
 2 files changed, 5 insertions(+), 4 deletions(-)
ea5d11
ea5d11
diff --git a/base/gdevpdfp.c b/base/gdevpdfp.c
ea5d11
index 7e12fe1..d0f0992 100644
ea5d11
--- a/base/gdevpdfp.c
ea5d11
+++ b/base/gdevpdfp.c
ea5d11
@@ -320,7 +320,7 @@ gdev_pdf_put_params_impl(gx_device * dev, const gx_device_pdf * save_dev, gs_par
ea5d11
      * LockDistillerParams is read again, and reset if necessary, in
ea5d11
      * psdf_put_params.
ea5d11
      */
ea5d11
-    ecode = code = param_read_bool(plist, "LockDistillerParams", &locked);
ea5d11
+    ecode = code = param_read_bool(plist, (param_name = "LockDistillerParams"), &locked);
ea5d11
     if (ecode < 0)
ea5d11
         param_signal_error(plist, param_name, ecode);
ea5d11
 
ea5d11
diff --git a/psi/iparam.c b/psi/iparam.c
ea5d11
index 559b9b8..6f35745 100644
ea5d11
--- a/psi/iparam.c
ea5d11
+++ b/psi/iparam.c
ea5d11
@@ -821,10 +821,11 @@ static int
ea5d11
 ref_param_read_signal_error(gs_param_list * plist, gs_param_name pkey, int code)
ea5d11
 {
ea5d11
     iparam_list *const iplist = (iparam_list *) plist;
ea5d11
-    iparam_loc loc;
ea5d11
+    iparam_loc loc = {0};
ea5d11
 
ea5d11
-    ref_param_read(iplist, pkey, &loc, -1);	/* can't fail */
ea5d11
-    *loc.presult = code;
ea5d11
+    ref_param_read(iplist, pkey, &loc, -1);
ea5d11
+    if (loc.presult)
ea5d11
+        *loc.presult = code;
ea5d11
     switch (ref_param_read_get_policy(plist, pkey)) {
ea5d11
         case gs_param_policy_ignore:
ea5d11
             return 0;
ea5d11
-- 
ea5d11
2.14.4
ea5d11