diff options
author | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2008-12-09 14:00:43 +0400 |
---|---|---|
committer | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2008-12-09 14:00:43 +0400 |
commit | 0661c210d3813a73d678f7e9d8347762b8a984a5 (patch) | |
tree | f0ac868ad3c90b6e75685755488f0ca501e874d1 /sql/item_strfunc.h | |
parent | eb46763654e3f432d2e654681e9c079cbc3d4af0 (diff) | |
download | mariadb-git-0661c210d3813a73d678f7e9d8347762b8a984a5.tar.gz |
bug#35558 Wrong server metadata blows up the client
the problem: FORMAT func max_length value was calculated incorrectly
the fix: correct calculation of max_length
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r-- | sql/item_strfunc.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 3648438a69b..23ac20a4017 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -516,8 +516,9 @@ public: { collation.set(default_charset()); uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen; - max_length= ((char_length + (char_length-args[0]->decimals)/3) * - collation.collation->mbmaxlen); + uint max_sep_count= char_length/3 + (decimals ? 1 : 0) + /*sign*/1; + max_length= (char_length + max_sep_count + decimals) * + collation.collation->mbmaxlen; } const char *func_name() const { return "format"; } void print(String *); |