List:Commits« Previous MessageNext Message »
From:ramil Date:October 17 2007 11:28am
Subject:bk commit into 4.1 tree (ramil:1.2689) BUG#31615
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of ram. When ram does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-10-17 14:28:00+05:00, ramil@stripped +4 -0
  Fix for bug#31615: crash after set names ucs2 collate xxx
  
  Problem: currently, UCS-2 cannot be used as a client character set.
  
  Fix: raise an error if one attempts to set it to USC-2.

  mysql-test/r/ctype_ucs.result@stripped, 2007-10-17 14:27:58+05:00, ramil@stripped +8 -0
    Fix for bug#31615: crash after set names ucs2 collate xxx
      - test result.

  mysql-test/t/ctype_ucs.test@stripped, 2007-10-17 14:27:58+05:00, ramil@stripped +12 -0
    Fix for bug#31615: crash after set names ucs2 collate xxx
      - test case.

  sql/set_var.cc@stripped, 2007-10-17 14:27:58+05:00, ramil@stripped +22 -0
    Fix for bug#31615: crash after set names ucs2 collate xxx
      - raise an error if one is going to set character_set_client to UCS-2.

  sql/set_var.h@stripped, 2007-10-17 14:27:58+05:00, ramil@stripped +1 -0
    Fix for bug#31615: crash after set names ucs2 collate xxx
      - raise an error if one is going to set character_set_client to UCS-2.

diff -Nrup a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
--- a/mysql-test/r/ctype_ucs.result	2006-10-03 14:11:54 +05:00
+++ b/mysql-test/r/ctype_ucs.result	2007-10-17 14:27:58 +05:00
@@ -803,4 +803,12 @@ quote(name)
 ????????
 ????????????????
 drop table bug20536;
+set names ucs2;
+ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2'
+set names ucs2 collate ucs2_bin;
+ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2'
+set character_set_client= ucs2;
+ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2'
+set character_set_client= concat('ucs', substr('2', 1));
+ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2'
 End of 4.1 tests
diff -Nrup a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
--- a/mysql-test/t/ctype_ucs.test	2006-10-03 14:11:54 +05:00
+++ b/mysql-test/t/ctype_ucs.test	2007-10-17 14:27:58 +05:00
@@ -535,4 +535,16 @@ select quote(name) from bug20536;
 
 drop table bug20536;
 
+#
+# Bug #31615: crash after set names ucs2 collate xxx
+#
+--error 1231
+set names ucs2;
+--error 1231
+set names ucs2 collate ucs2_bin;
+--error 1231
+set character_set_client= ucs2;
+--error 1231
+set character_set_client= concat('ucs', substr('2', 1));
+
 --echo End of 4.1 tests
diff -Nrup a/sql/set_var.cc b/sql/set_var.cc
--- a/sql/set_var.cc	2007-05-08 12:09:24 +05:00
+++ b/sql/set_var.cc	2007-10-17 14:27:58 +05:00
@@ -1992,6 +1992,21 @@ void sys_var_character_set_client::set_d
 }
 
 
+bool sys_var_character_set_client::check(THD *thd, set_var *var)
+{
+  if (sys_var_character_set::check(thd, var))
+    return 1;
+  /* Currently, UCS-2 cannot be used as a client character set */
+  if (var->save_result.charset->mbminlen > 1)
+  {
+    my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, 
+             var->save_result.charset->csname); 
+    return 1;
+  }
+  return 0;
+}
+
+
 CHARSET_INFO **
 sys_var_character_set_results::ci_ptr(THD *thd, enum_var_type type)
 {
@@ -2355,6 +2370,13 @@ end:
 
 int set_var_collation_client::check(THD *thd)
 {
+  /* Currently, UCS-2 cannot be used as a client character set */
+  if (character_set_client->mbminlen > 1)
+  {
+    my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "character_set_client",
+             character_set_client->csname);
+    return 1;
+  }
   return 0;
 }
 
diff -Nrup a/sql/set_var.h b/sql/set_var.h
--- a/sql/set_var.h	2006-12-05 13:45:17 +04:00
+++ b/sql/set_var.h	2007-10-17 14:27:58 +05:00
@@ -578,6 +578,7 @@ public:
     sys_var_character_set(name_arg) {}
   void set_default(THD *thd, enum_var_type type);
   CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
+  bool check(THD *thd, set_var *var);
 };
 
 class sys_var_character_set_results :public sys_var_character_set
Thread
bk commit into 4.1 tree (ramil:1.2689) BUG#31615ramil17 Oct