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

ed4834
From 606a22e77e7f081781e99e44644cd0119f559e03 Mon Sep 17 00:00:00 2001
bd82b2
From: Ken Sharp <ken.sharp@artifex.com>
ed4834
Date: Wed, 14 Nov 2018 09:27:00 +0000
ed4834
Subject: [PATCH] Bug #700168 - add a type check
bd82b2
bd82b2
Bug #700168 "Type confusion in JBIG2Decode"
bd82b2
bd82b2
The code was assuming that .jbig2globalctx was a structure allocated
bd82b2
by the graphics library, without checking.
bd82b2
bd82b2
Add a check to see that it is a structure and that its the correct
bd82b2
type of structure.
bd82b2
---
ed4834
 psi/zfjbig2.c | 2 ++
ed4834
 1 file changed, 2 insertions(+)
bd82b2
ed4834
diff --git a/psi/zfjbig2.c b/psi/zfjbig2.c
ed4834
index a3d13a2..07b470f 100644
ed4834
--- a/psi/zfjbig2.c
ed4834
+++ b/psi/zfjbig2.c
bd82b2
@@ -72,6 +72,8 @@ z_jbig2decode(i_ctx_t * i_ctx_p)
bd82b2
     if (r_has_type(op, t_dictionary)) {
bd82b2
         check_dict_read(*op);
bd82b2
         if ( dict_find_string(op, ".jbig2globalctx", &sop) > 0) {
bd82b2
+            if (!r_is_struct(sop) || !r_has_stype(sop, imemory, st_jbig2_global_data_t))
bd82b2
+                return_error(gs_error_typecheck);
bd82b2
             gref = r_ptr(sop, s_jbig2_global_data_t);
bd82b2
             s_jbig2decode_set_global_data((stream_state*)&state, gref);
bd82b2
         }
ed4834
-- 
ed4834
2.17.2
ed4834