summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2011-07-18 10:27:05 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2011-07-18 10:27:05 +0200
commit980ba4934fc4e57bb107777d44631f92fb0c6fc7 (patch)
treed962f80742c50b657df1b70fecdbae5d3a2ae35b /sql/item_strfunc.cc
parent1d0a65aa38aa8c4c08baaa1da72b996ea040e99d (diff)
downloadmariadb-git-980ba4934fc4e57bb107777d44631f92fb0c6fc7.tar.gz
Bug#12368853 FORMAT() CRASHES WITH LARGE NUMBERS AFTER TRUNCATE...
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 9ea9cbc7312..55087879b98 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2316,7 +2316,7 @@ String *Item_func_format::val_str_ascii(String *str)
return 0; /* purecov: inspected */
nr= my_double_round(nr, (longlong) dec, FALSE, FALSE);
str->set_real(nr, dec, &my_charset_numeric);
- if (isnan(nr))
+ if (isnan(nr) || my_isinf(nr))
return str;
str_length=str->length();
}
@@ -2372,6 +2372,7 @@ String *Item_func_format::val_str_ascii(String *str)
For short values without thousands (<1000)
replace decimal point to localized value.
*/
+ DBUG_ASSERT(dec_length <= str_length);
((char*) str->ptr())[str_length - dec_length]= lc->decimal_point;
}
return str;