summaryrefslogtreecommitdiff
path: root/strings/decimal.c
diff options
context:
space:
mode:
Diffstat (limited to 'strings/decimal.c')
-rw-r--r--strings/decimal.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index b29017aa6cb..0768c8cd4ca 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1089,7 +1089,11 @@ int decimal2longlong(decimal_t *from, longlong *to)
x=x*DIG_BASE - *buf++;
if (unlikely(y < (LONGLONG_MIN/DIG_BASE) || x > y))
{
- *to= from->sign ? y : -y;
+ /*
+ the decimal is bigger than any possible integer
+ return border integer depending on the sign
+ */
+ *to= from->sign ? LONGLONG_MIN : LONGLONG_MAX;
return E_DEC_OVERFLOW;
}
}