diff options
author | Tor Didriksen <tor.didriksen@oracle.com> | 2010-11-17 16:39:35 +0100 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@oracle.com> | 2010-11-17 16:39:35 +0100 |
commit | 0654c94ca231a7817369056697ed13e9a2ad5b87 (patch) | |
tree | decc5f690acbbb671f63abf25ccdf2e44c71a82b /sql/field.cc | |
parent | 46dd9e86580e523c2c8a1503552be41751f31229 (diff) | |
download | mariadb-git-0654c94ca231a7817369056697ed13e9a2ad5b87.tar.gz |
Bug #58137 char(0) column cause: my_gcvt: Assertion `width > 0 && to != ((void *)0)' failed
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/field.cc b/sql/field.cc index a9b5fedda2d..e5cae9ea8e3 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -6327,10 +6327,13 @@ int Field_str::store(double nr) ASSERT_COLUMN_MARKED_FOR_WRITE; char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; uint local_char_length= field_length / charset()->mbmaxlen; - size_t length; - my_bool error; + size_t length= 0; + my_bool error= (local_char_length == 0); + + // my_gcvt() requires width > 0, and we may have a CHAR(0) column. + if (!error) + length= my_gcvt(nr, MY_GCVT_ARG_DOUBLE, local_char_length, buff, &error); - length= my_gcvt(nr, MY_GCVT_ARG_DOUBLE, local_char_length, buff, &error); if (error) { if (table->in_use->abort_on_warning) |