|
|
3a994f |
From b80fc8cd2469fcdab0630cd507f42b410bb96fda Mon Sep 17 00:00:00 2001
|
|
|
3a994f |
From: Ken Sharp <ken.sharp@artifex.com>
|
|
|
3a994f |
Date: Wed, 5 Oct 2016 10:10:58 +0100
|
|
|
3a994f |
Subject: [PATCH] DSC parser - validate parameters
|
|
|
3a994f |
|
|
|
3a994f |
Bug #697190 ".initialize_dsc_parser doesn't validate the parameter is a dict type before using it."
|
|
|
3a994f |
|
|
|
3a994f |
Regardless of any security implications, its simply wrong for a PostScript
|
|
|
3a994f |
operator not to validate its parameter(s).
|
|
|
3a994f |
|
|
|
3a994f |
No differences expected.
|
|
|
3a994f |
---
|
|
|
3a994f |
psi/zdscpars.c | 13 +++++++++----
|
|
|
3a994f |
1 file changed, 9 insertions(+), 4 deletions(-)
|
|
|
3a994f |
|
|
|
3a994f |
diff --git a/psi/zdscpars.c b/psi/zdscpars.c
|
|
|
3a994f |
index a6f8fc9..fa61d88 100644
|
|
|
3a994f |
--- a/psi/zdscpars.c
|
|
|
3a994f |
+++ b/psi/zdscpars.c
|
|
|
3a994f |
@@ -132,11 +132,16 @@ zinitialize_dsc_parser(i_ctx_t *i_ctx_p)
|
|
|
3a994f |
ref local_ref;
|
|
|
3a994f |
int code;
|
|
|
3a994f |
os_ptr const op = osp;
|
|
|
3a994f |
- dict * const pdict = op->value.pdict;
|
|
|
3a994f |
- gs_memory_t * const mem = (gs_memory_t *)dict_memory(pdict);
|
|
|
3a994f |
- dsc_data_t * const data =
|
|
|
3a994f |
- gs_alloc_struct(mem, dsc_data_t, &st_dsc_data_t, "DSC parser init");
|
|
|
3a994f |
+ dict *pdict;
|
|
|
3a994f |
+ gs_memory_t *mem;
|
|
|
3a994f |
+ dsc_data_t *data;
|
|
|
3a994f |
|
|
|
3a994f |
+ check_read_type(*op, t_dictionary);
|
|
|
3a994f |
+
|
|
|
3a994f |
+ pdict = op->value.pdict;
|
|
|
3a994f |
+ mem = (gs_memory_t *)dict_memory(pdict);
|
|
|
3a994f |
+
|
|
|
3a994f |
+ data = gs_alloc_struct(mem, dsc_data_t, &st_dsc_data_t, "DSC parser init");
|
|
|
3a994f |
if (!data)
|
|
|
3a994f |
return_error(e_VMerror);
|
|
|
3a994f |
data->document_level = 0;
|
|
|
3a994f |
--
|
|
|
3a994f |
2.7.4
|
|
|
3a994f |
|