summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2018-11-15 15:24:10 +0000
committerChris Liddell <chris.liddell@artifex.com>2018-11-16 15:04:51 +0000
commit4548ceaf5ada7f7a4c4da5907e27fec62c1ce63d (patch)
tree69ad4671123e721bcd47d9c1c715d2ff42742449
parenta4e3cb230bfdbf9cb5a0d30763889e58f8215ed1 (diff)
downloadghostpdl-4548ceaf5ada7f7a4c4da5907e27fec62c1ce63d.tar.gz
PS interpreter - check infinite result on exp, where possible
Bug #700181 "using exp with 0 as base" (again) The reporter for the bug failed to mention this condition in the original report. Technically we don't always have isinf() available (I suspect all real compilers do these days) but where we do we can check the result. Where we don't, we're stuck. This mimics the behaviour of other math operations in Ghostscript.
-rw-r--r--psi/zmath.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/psi/zmath.c b/psi/zmath.c
index 311899f81..3beb3dd62 100644
--- a/psi/zmath.c
+++ b/psi/zmath.c
@@ -158,6 +158,10 @@ zexp(i_ctx_t *i_ctx_p)
else
result = pow(args[0], args[1]);
make_real(op - 1, result);
+#ifdef HAVE_ISINF
+ if (isinf((op - 1)->value.realval))
+ return_error(gs_error_undefinedresult);
+#endif
pop(1);
return 0;
}