summaryrefslogtreecommitdiff
path: root/strings/decimal.c
diff options
context:
space:
mode:
authorhf@deer.(none) <>2005-06-15 19:02:35 +0500
committerhf@deer.(none) <>2005-06-15 19:02:35 +0500
commit971eaa189dc79a4f676d0418b2b122516054289e (patch)
tree2268d066683e95ed6e8f926cec22816a1105f198 /strings/decimal.c
parent66591aea022251cf4901d86fcd3774ec121d5560 (diff)
downloadmariadb-git-971eaa189dc79a4f676d0418b2b122516054289e.tar.gz
Fix for bug #10337 (cast(NULL DECIMAL) crashes the server)
Diffstat (limited to 'strings/decimal.c')
-rw-r--r--strings/decimal.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index 4a487f3c9b0..c94c6788e29 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1563,7 +1563,13 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
break;
if (buf1-- == to->buf)
{
- decimal_make_zero(to);
+ /* making 'zero' with the proper scale */
+ dec1 *p0= to->buf + frac0 + 1;
+ to->intg=1;
+ to->frac= max(scale, 0);
+ to->sign= 0;
+ for (buf1= to->buf; buf1<p0; buf1++)
+ *buf1= 0;
return E_DEC_OK;
}
}