summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2018-11-15 15:24:10 +0000
committerKen Sharp <ken.sharp@artifex.com>2018-11-15 15:24:10 +0000
commit46d3a9a658f3b92e554cffc3c2ace8c140118155 (patch)
tree77690b546790dcbf2417b57668cfaa1c2b17af86
parent1218b59561ba950e212ad4e585bd7b0612eb2102 (diff)
downloadghostpdl-46d3a9a658f3b92e554cffc3c2ace8c140118155.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;
}