summaryrefslogtreecommitdiff
path: root/psi/zmisc3.c
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2017-05-03 12:05:45 +0100
committerChris Liddell <chris.liddell@artifex.com>2017-05-03 14:08:54 +0100
commit57f20719e1cfaea77b67cb26e26de7fe4d7f9b2e (patch)
tree84eaa628b05edf7d22e1bb58f94a161a83601bbd /psi/zmisc3.c
parent2a619d16d86348805b1732fb1e21c88dd00374fd (diff)
downloadghostpdl-57f20719e1cfaea77b67cb26e26de7fe4d7f9b2e.tar.gz
Bug 697846: revision to commit 4f83478c88 (.eqproc)
When using the "DELAYBIND" feature, it turns out that .eqproc can be called with parameters that are not both procedures. In this case, it turns out, the expectation is for the operator to return 'false', rather than throw an error.
Diffstat (limited to 'psi/zmisc3.c')
-rw-r--r--psi/zmisc3.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/psi/zmisc3.c b/psi/zmisc3.c
index 37293ff4b..3f01d39a3 100644
--- a/psi/zmisc3.c
+++ b/psi/zmisc3.c
@@ -38,6 +38,15 @@ zcliprestore(i_ctx_t *i_ctx_p)
return gs_cliprestore(igs);
}
+static inline bool
+eqproc_check_type(ref *r)
+{
+ return r_has_type(r, t_array)
+ || r_has_type(r, t_mixedarray)
+ || r_has_type(r, t_shortarray)
+ || r_has_type(r, t_oparray);
+}
+
/* <proc1> <proc2> .eqproc <bool> */
/*
* Test whether two procedures are equal to depth 10.
@@ -58,8 +67,10 @@ zeqproc(i_ctx_t *i_ctx_p)
if (ref_stack_count(&o_stack) < 2)
return_error(gs_error_stackunderflow);
- if (!r_is_array(op - 1) || !r_is_array(op)) {
- return_error(gs_error_typecheck);
+ if (!eqproc_check_type(op -1) || !eqproc_check_type(op)) {
+ make_false(op - 1);
+ pop(1);
+ return 0;
}
make_array(&stack[0].proc1, 0, 1, op - 1);