On Tue, May 16, 2017 at 03:25:17PM +0300, Paul Irofti wrote:
> Along with the openvpn backport that jca committed, I also backported
> and tested print/ghostscript/gnu. OK?
OK bluhm@
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/print/ghostscript/gnu/Makefile,v
> retrieving revision 1.108
> diff -u -p -r1.108 Makefile
> --- Makefile 13 Sep 2016 18:52:05 -0000 1.108
> +++ Makefile 15 May 2017 14:56:36 -0000
> @@ -1,4 +1,4 @@
> -# $OpenBSD: Makefile,v 1.108 2016/09/13 18:52:05 naddy Exp $
> +# $OpenBSD: Makefile,v 1.109 2017/05/04 06:51:09 bluhm Exp $
>
> COMMENT= GNU PostScript interpreter
>
> @@ -6,7 +6,7 @@ VERSION= 9.07
> DISTNAME= ghostscript-${VERSION}
> CATEGORIES= print lang
> SHARED_LIBS= gs 15.0
> -REVISION= 3
> +REVISION= 4
>
> MASTER_SITES= http://downloads.ghostscript.com/public/
>
> Index: patches/patch-psi_zfrsd_c
> ===================================================================
> RCS file: patches/patch-psi_zfrsd_c
> diff -N patches/patch-psi_zfrsd_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-psi_zfrsd_c 15 May 2017 14:56:36 -0000
> @@ -0,0 +1,49 @@
> +$OpenBSD: patch-psi_zfrsd_c,v 1.1 2017/05/04 06:51:09 bluhm Exp $
> +
> +https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=04b37bbce1
> +
> +Index: psi/zfrsd.c
> +--- psi/zfrsd.c.orig
> ++++ psi/zfrsd.c
> +@@ -49,13 +49,20 @@ zrsdparams(i_ctx_t *i_ctx_p)
> + ref *pFilter;
> + ref *pDecodeParms;
> + int Intent = 0;
> +- bool AsyncRead;
> ++ bool AsyncRead = false;
> + ref empty_array, filter1_array, parms1_array;
> + uint i;
> +- int code;
> ++ int code = 0;
> +
> ++ if (ref_stack_count(&o_stack) < 1)
> ++ return_error(e_stackunderflow);
> ++ if (!r_has_type(op, t_dictionary) && !r_has_type(op, t_null)) {
> ++ return_error(e_typecheck);
> ++ }
> ++
> + make_empty_array(&empty_array, a_readonly);
> +- if (dict_find_string(op, "Filter", &pFilter) > 0) {
> ++ if (r_has_type(op, t_dictionary)
> ++ && dict_find_string(op, "Filter", &pFilter) > 0) {
> + if (!r_is_array(pFilter)) {
> + if (!r_has_type(pFilter, t_name))
> + return_error(e_typecheck);
> +@@ -94,12 +101,13 @@ zrsdparams(i_ctx_t *i_ctx_p)
> + return_error(e_typecheck);
> + }
> + }
> +- code = dict_int_param(op, "Intent", 0, 3, 0, &Intent);
> ++ if (r_has_type(op, t_dictionary))
> ++ code = dict_int_param(op, "Intent", 0, 3, 0, &Intent);
> + if (code < 0 && code != e_rangecheck) /* out-of-range int is ok, use 0
> */
> + return code;
> +- if ((code = dict_bool_param(op, "AsyncRead", false, &AsyncRead)) < 0
> +- )
> +- return code;
> ++ if (r_has_type(op, t_dictionary))
> ++ if ((code = dict_bool_param(op, "AsyncRead", false, &AsyncRead)) <
> 0)
> ++ return code;
> + push(1);
> + op[-1] = *pFilter;
> + if (pDecodeParms)
> Index: patches/patch-psi_zmisc3_c
> ===================================================================
> RCS file: patches/patch-psi_zmisc3_c
> diff -N patches/patch-psi_zmisc3_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-psi_zmisc3_c 15 May 2017 14:56:36 -0000
> @@ -0,0 +1,20 @@
> +$OpenBSD: patch-psi_zmisc3_c,v 1.1 2017/05/04 06:51:09 bluhm Exp $
> +
> +https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=4f83478c88
> +
> +Index: psi/zmisc3.c
> +--- psi/zmisc3.c.orig
> ++++ psi/zmisc3.c
> +@@ -56,6 +56,12 @@ zeqproc(i_ctx_t *i_ctx_p)
> + ref2_t stack[MAX_DEPTH + 1];
> + ref2_t *top = stack;
> +
> ++ if (ref_stack_count(&o_stack) < 2)
> ++ return_error(e_stackunderflow);
> ++ if (!r_is_array(op - 1) || !r_is_array(op)) {
> ++ return_error(e_typecheck);
> ++ }
> ++
> + make_array(&stack[0].proc1, 0, 1, op - 1);
> + make_array(&stack[0].proc2, 0, 1, op);
> + for (;;) {