diff options
Diffstat (limited to 'strings/decimal.c')
-rw-r--r-- | strings/decimal.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/strings/decimal.c b/strings/decimal.c index e64f7634a45..5f451d668e3 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1005,7 +1005,8 @@ static int ull2dec(ulonglong from, decimal_t *to) error=E_DEC_OVERFLOW; } to->frac=0; - to->intg=intg1*DIG_PER_DEC1; + /* intg can't be bigger than number of digits in a ulonglong (20) */ + to->intg= MY_MIN(intg1*DIG_PER_DEC1, 20); for (buf=to->buf+intg1; intg1; intg1--) { |