summaryrefslogtreecommitdiff
path: root/strings/decimal.c
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2015-12-10 11:22:53 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2015-12-10 11:22:53 +0100
commitfa25921b59aacdc6be050653f6cce17df12c6937 (patch)
treecdb4e285cab06a07fe5d690c74b621589c0237e6 /strings/decimal.c
parentd67aacb4fbb449ffa8db4e3d70fe8756d62b5222 (diff)
downloadmariadb-git-fa25921b59aacdc6be050653f6cce17df12c6937.tar.gz
MDEV-8407 Numeric errors, server crash with COLUMN_JSON() on DECIMAL with precision > 40
In fact it was error in decimal library (incorrect processing of buffer overflow) invisible from other server parts because of buffer allocation and precision tests.
Diffstat (limited to 'strings/decimal.c')
-rw-r--r--strings/decimal.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index 07ccc537e47..8dbe1bd57f4 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -383,7 +383,8 @@ int decimal2string(const decimal_t *from, char *to, int *to_len,
}
else
frac-=j;
- len= from->sign + intg_len + test(frac) + frac_len;
+ frac_len= frac;
+ len= from->sign + intg_len + test(frac) + frac;
}
*to_len=len;
s[len]=0;