summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbar@mysql.com <>2006-03-20 14:43:02 +0400
committerbar@mysql.com <>2006-03-20 14:43:02 +0400
commit33e446b356f6054e0f03f64a91220e33be385204 (patch)
tree6f4fcac8a9253b59ace7ac331f8f1c75bb46de80
parent56fca811bb9caae713a3477dfbe3ae5fe0991431 (diff)
downloadmariadb-git-33e446b356f6054e0f03f64a91220e33be385204.tar.gz
Bug#18004 Connecting crashes server when default charset is UCS2
table.cc: Fixing to use system_charset_info instead of default_charset_info. Crash happened because the "ctype" array is empty in UCS2, and thus cannot be used with my_isspace(). The reason why UCS2 appeared in this context was because of of default_charset_info variable incorrectly substituted to my_isspace(). As functions check_db_name(), check_table_name() and check_column_name() always get values in utf8, system_charset_info must be used instead. ctype_ucs2_def.test, ctype_ucs2_def-master.opt, ctype_ucs2_def.result: new file
-rw-r--r--mysql-test/r/ctype_ucs2_def.result6
-rw-r--r--mysql-test/t/ctype_ucs2_def-master.opt1
-rw-r--r--mysql-test/t/ctype_ucs2_def.test9
-rw-r--r--sql/table.cc6
4 files changed, 19 insertions, 3 deletions
diff --git a/mysql-test/r/ctype_ucs2_def.result b/mysql-test/r/ctype_ucs2_def.result
new file mode 100644
index 00000000000..897dbac251c
--- /dev/null
+++ b/mysql-test/r/ctype_ucs2_def.result
@@ -0,0 +1,6 @@
+show variables like "%character_set_ser%";
+Variable_name Value
+character_set_server ucs2
+DROP TABLE IF EXISTS t1;
+create table t1 (a int);
+drop table t1;
diff --git a/mysql-test/t/ctype_ucs2_def-master.opt b/mysql-test/t/ctype_ucs2_def-master.opt
new file mode 100644
index 00000000000..1f884ff1d67
--- /dev/null
+++ b/mysql-test/t/ctype_ucs2_def-master.opt
@@ -0,0 +1 @@
+--default-character-set=ucs2 --default-collation=ucs2_unicode_ci
diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test
new file mode 100644
index 00000000000..fb174d551cf
--- /dev/null
+++ b/mysql-test/t/ctype_ucs2_def.test
@@ -0,0 +1,9 @@
+#
+# Bug#18004 Connecting crashes server when default charset is UCS2
+#
+show variables like "%character_set_ser%";
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+create table t1 (a int);
+drop table t1;
diff --git a/sql/table.cc b/sql/table.cc
index de539205ffd..8ac64ac198d 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1423,7 +1423,7 @@ bool check_db_name(char *name)
while (*name)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
- last_char_is_space= my_isspace(default_charset_info, *name);
+ last_char_is_space= my_isspace(system_charset_info, *name);
if (use_mb(system_charset_info))
{
int len=my_ismbchar(system_charset_info, name,
@@ -1469,7 +1469,7 @@ bool check_table_name(const char *name, uint length)
while (name != end)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
- last_char_is_space= my_isspace(default_charset_info, *name);
+ last_char_is_space= my_isspace(system_charset_info, *name);
if (use_mb(system_charset_info))
{
int len=my_ismbchar(system_charset_info, name, end);
@@ -1500,7 +1500,7 @@ bool check_column_name(const char *name)
while (*name)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
- last_char_is_space= my_isspace(default_charset_info, *name);
+ last_char_is_space= my_isspace(system_charset_info, *name);
if (use_mb(system_charset_info))
{
int len=my_ismbchar(system_charset_info, name,