Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / patches / ghostscript-CVE-2016-7979.patch
CommitLineData
1de17a64
MW
1The following patch was adapted for GNU Ghostscript
2by Mark H Weaver <mhw@netris.org> based on:
3
4http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=875a0095f37626a721c7ff57d606a0f95af03913
5
6From 875a0095f37626a721c7ff57d606a0f95af03913 Mon Sep 17 00:00:00 2001
7From: Ken Sharp <ken.sharp@artifex.com>
8Date: Wed, 5 Oct 2016 10:10:58 +0100
9Subject: [PATCH] DSC parser - validate parameters
10
11Bug #697190 ".initialize_dsc_parser doesn't validate the parameter is a dict type before using it."
12
13Regardless of any security implications, its simply wrong for a PostScript
14operator not to validate its parameter(s).
15
16No differences expected.
17---
18 psi/zdscpars.c | 13 +++++++++----
19 1 file changed, 9 insertions(+), 4 deletions(-)
20
21diff --git a/psi/zdscpars.c b/psi/zdscpars.c
22index c05e154..9b4b605 100644
23--- a/psi/zdscpars.c
24+++ b/psi/zdscpars.c
25@@ -150,11 +150,16 @@ zinitialize_dsc_parser(i_ctx_t *i_ctx_p)
26 ref local_ref;
27 int code;
28 os_ptr const op = osp;
29- dict * const pdict = op->value.pdict;
30- gs_memory_t * const mem = (gs_memory_t *)dict_memory(pdict);
31- dsc_data_t * const data =
32- gs_alloc_struct(mem, dsc_data_t, &st_dsc_data_t, "DSC parser init");
33+ dict *pdict;
34+ gs_memory_t *mem;
35+ dsc_data_t *data;
36
37+ check_read_type(*op, t_dictionary);
38+
39+ pdict = op->value.pdict;
40+ mem = (gs_memory_t *)dict_memory(pdict);
41+
42+ data = gs_alloc_struct(mem, dsc_data_t, &st_dsc_data_t, "DSC parser init");
43 if (!data)
44 return_error(e_VMerror);
45 data->document_level = 0;
46--
472.9.1
48