Fix crash on numeric comparison (ref #2804) (#2818)
diff --git a/src/jv.c b/src/jv.c
index 3812777..933ed7b 100644
--- a/src/jv.c
+++ b/src/jv.c
@@ -536,7 +536,7 @@
if (key == &dec_ctx_key)
{
decContextDefault(ctx, DEC_INIT_BASE);
- ctx->digits = DEC_MAX_DIGITS;
+ ctx->digits = DEC_MAX_DIGITS - 1;
ctx->traps = 0; /*no errors*/
}
else if (key == &dec_ctx_dbl_key)
diff --git a/tests/jq.test b/tests/jq.test
index 246da0f..3ba29ad 100644
--- a/tests/jq.test
+++ b/tests/jq.test
@@ -556,6 +556,10 @@
null
1e+17
+5E500000000>5E-5000000000
+null
+true
+
25 % 7
null
4