summaryrefslogtreecommitdiff
path: root/strings/decimal.c
diff options
context:
space:
mode:
authorholyfoot/hf@hfmain.(none) <>2007-05-16 23:01:21 +0500
committerholyfoot/hf@hfmain.(none) <>2007-05-16 23:01:21 +0500
commitcd4fbe116edd8d1d0634f4b96e5e0143b3dd97dd (patch)
tree17df03511ee07061a062ea2c79293477f35cf0bc /strings/decimal.c
parent353eac9557563cc01f2e306ce178d096fd4f2bbe (diff)
parentbb089cea3852546e37d6a241b35f9223759b88c1 (diff)
downloadmariadb-git-cd4fbe116edd8d1d0634f4b96e5e0143b3dd97dd.tar.gz
Merge mysql.com:/home/hf/work/8663/my50-8663
into mysql.com:/home/hf/work/8663/my51-8663
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;
}
}