List:Commits« Previous MessageNext Message »
From:ramil Date:October 4 2007 7:20am
Subject:bk commit into 4.1 tree (ramil:1.2685) BUG#31069
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-04 10:20:00+05:00, ramil@stripped +11 -0
  Fix for bug #31069: crash in 'sounds like'
  and for bug #31070: crash during conversion of charsets
  
  Problem: passing a 0 byte length string to some my_mb_wc_XXX() 
  functions leads to server crash due to improper argument check.
  
  Fix: properly check arguments passed to my_mb_wc_XXX() functions.

  mysql-test/include/ctype_common.inc@stripped, 2007-10-04 10:19:59+05:00, ramil@stripped +9
-0
    Fix for bug #31069: crash in 'sounds like'
    and bug #31070: crash during conversion of charsets
      - test case.

  mysql-test/r/ctype_big5.result@stripped, 2007-10-04 10:19:59+05:00, ramil@stripped +11 -0
    Fix for bug #31069: crash in 'sounds like'
    and bug #31070: crash during conversion of charsets
      - test result.

  mysql-test/r/ctype_euckr.result@stripped, 2007-10-04 10:19:59+05:00, ramil@stripped +11 -0
    Fix for bug #31069: crash in 'sounds like'
    and bug #31070: crash during conversion of charsets
      - test result.

  mysql-test/r/ctype_gb2312.result@stripped, 2007-10-04 10:19:59+05:00, ramil@stripped +11 -0
    Fix for bug #31069: crash in 'sounds like'
    and bug #31070: crash during conversion of charsets
      - test result.

  mysql-test/r/ctype_gbk.result@stripped, 2007-10-04 10:19:59+05:00, ramil@stripped +11 -0
    Fix for bug #31069: crash in 'sounds like'
    and bug #31070: crash during conversion of charsets
      - test result.

  mysql-test/r/ctype_uca.result@stripped, 2007-10-04 10:19:59+05:00, ramil@stripped +11 -0
    Fix for bug #31069: crash in 'sounds like'
    and bug #31070: crash during conversion of charsets
      - test result.

  strings/ctype-big5.c@stripped, 2007-10-04 10:19:59+05:00, ramil@stripped +2 -2
    Fix for bug #31069: crash in 'sounds like'
    and bug #31070: crash during conversion of charsets
      - check the string length before testing its first byte.

  strings/ctype-cp932.c@stripped, 2007-10-04 10:19:59+05:00, ramil@stripped +2 -2
    Fix for bug #31069: crash in 'sounds like'
    and bug #31070: crash during conversion of charsets
      - check the string length before testing its first byte.

  strings/ctype-euc_kr.c@stripped, 2007-10-04 10:19:59+05:00, ramil@stripped +2 -2
    Fix for bug #31069: crash in 'sounds like'
    and bug #31070: crash during conversion of charsets
      - check the string length before testing its first byte.

  strings/ctype-gb2312.c@stripped, 2007-10-04 10:19:59+05:00, ramil@stripped +1 -3
    Fix for bug #31069: crash in 'sounds like'
    and bug #31070: crash during conversion of charsets
      - check the string length before testing its first byte.

  strings/ctype-sjis.c@stripped, 2007-10-04 10:19:59+05:00, ramil@stripped +2 -2
    Fix for bug #31069: crash in 'sounds like'
    and bug #31070: crash during conversion of charsets
      - check the string length before testing its first byte.

diff -Nrup a/mysql-test/include/ctype_common.inc b/mysql-test/include/ctype_common.inc
--- a/mysql-test/include/ctype_common.inc	2004-12-10 17:58:07 +04:00
+++ b/mysql-test/include/ctype_common.inc	2007-10-04 10:19:59 +05:00
@@ -51,6 +51,15 @@ SELECT c1 as want1result  from t1 where 
 SELECT c1 as want1result  from t1 where c1 like 'location%';
 DROP TABLE t1;
 
+#
+# Bug #31070: crash during conversion of charsets
+#
+create table t1 (a set('a') not null);
+insert into t1 values (),();
+select cast(a as char(1)) from t1;
+select a sounds like a from t1;
+drop table t1;
+
 DROP DATABASE d1;
 # Restore settings
 USE test;
diff -Nrup a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
--- a/mysql-test/r/ctype_big5.result	2005-12-12 21:36:21 +04:00
+++ b/mysql-test/r/ctype_big5.result	2007-10-04 10:19:59 +05:00
@@ -52,6 +52,17 @@ SELECT c1 as want1result  from t1 where 
 want1result
 location
 DROP TABLE t1;
+create table t1 (a set('a') not null);
+insert into t1 values (),();
+select cast(a as char(1)) from t1;
+cast(a as char(1))
+
+
+select a sounds like a from t1;
+a sounds like a
+1
+1
+drop table t1;
 DROP DATABASE d1;
 USE test;
 SET character_set_server= @safe_character_set_server;
diff -Nrup a/mysql-test/r/ctype_euckr.result b/mysql-test/r/ctype_euckr.result
--- a/mysql-test/r/ctype_euckr.result	2006-05-12 21:26:40 +05:00
+++ b/mysql-test/r/ctype_euckr.result	2007-10-04 10:19:59 +05:00
@@ -52,6 +52,17 @@ SELECT c1 as want1result  from t1 where 
 want1result
 location
 DROP TABLE t1;
+create table t1 (a set('a') not null);
+insert into t1 values (),();
+select cast(a as char(1)) from t1;
+cast(a as char(1))
+
+
+select a sounds like a from t1;
+a sounds like a
+1
+1
+drop table t1;
 DROP DATABASE d1;
 USE test;
 SET character_set_server= @safe_character_set_server;
diff -Nrup a/mysql-test/r/ctype_gb2312.result b/mysql-test/r/ctype_gb2312.result
--- a/mysql-test/r/ctype_gb2312.result	2006-05-12 21:26:40 +05:00
+++ b/mysql-test/r/ctype_gb2312.result	2007-10-04 10:19:59 +05:00
@@ -52,6 +52,17 @@ SELECT c1 as want1result  from t1 where 
 want1result
 location
 DROP TABLE t1;
+create table t1 (a set('a') not null);
+insert into t1 values (),();
+select cast(a as char(1)) from t1;
+cast(a as char(1))
+
+
+select a sounds like a from t1;
+a sounds like a
+1
+1
+drop table t1;
 DROP DATABASE d1;
 USE test;
 SET character_set_server= @safe_character_set_server;
diff -Nrup a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result
--- a/mysql-test/r/ctype_gbk.result	2005-12-12 21:36:39 +04:00
+++ b/mysql-test/r/ctype_gbk.result	2007-10-04 10:19:59 +05:00
@@ -52,6 +52,17 @@ SELECT c1 as want1result  from t1 where 
 want1result
 location
 DROP TABLE t1;
+create table t1 (a set('a') not null);
+insert into t1 values (),();
+select cast(a as char(1)) from t1;
+cast(a as char(1))
+
+
+select a sounds like a from t1;
+a sounds like a
+1
+1
+drop table t1;
 DROP DATABASE d1;
 USE test;
 SET character_set_server= @safe_character_set_server;
diff -Nrup a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
--- a/mysql-test/r/ctype_uca.result	2005-09-21 22:17:28 +05:00
+++ b/mysql-test/r/ctype_uca.result	2007-10-04 10:19:59 +05:00
@@ -2371,6 +2371,17 @@ SELECT c1 as want1result  from t1 where 
 want1result
 location
 DROP TABLE t1;
+create table t1 (a set('a') not null);
+insert into t1 values (),();
+select cast(a as char(1)) from t1;
+cast(a as char(1))
+
+
+select a sounds like a from t1;
+a sounds like a
+1
+1
+drop table t1;
 DROP DATABASE d1;
 USE test;
 SET character_set_server= @safe_character_set_server;
diff -Nrup a/strings/ctype-big5.c b/strings/ctype-big5.c
--- a/strings/ctype-big5.c	2005-12-12 21:38:37 +04:00
+++ b/strings/ctype-big5.c	2007-10-04 10:19:59 +05:00
@@ -6256,12 +6256,12 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribu
 	      my_wc_t *pwc,const uchar *s,const uchar *e)
 {
 
-  int hi=s[0];
+  int hi;
   
   if (s >= e)
     return MY_CS_TOOSMALL;
   
-  if (hi<0x80)
+  if ((hi= s[0]) < 0x80)
   {
     pwc[0]=hi;
     return 1;
diff -Nrup a/strings/ctype-cp932.c b/strings/ctype-cp932.c
--- a/strings/ctype-cp932.c	2005-12-12 21:39:04 +04:00
+++ b/strings/ctype-cp932.c	2007-10-04 10:19:59 +05:00
@@ -5352,12 +5352,12 @@ my_wc_mb_cp932(CHARSET_INFO *cs  __attri
 static int 
 my_mb_wc_cp932(CHARSET_INFO *cs  __attribute__((unused)),
 	      my_wc_t *pwc, const uchar *s, const uchar *e){
-  int hi=s[0];
+  int hi;
   
   if (s >= e)
     return MY_CS_TOOSMALL;
   
-  if (hi < 0x80)
+  if ((hi= s[0]) < 0x80)
   {
     pwc[0]=hi;
     return 1;
diff -Nrup a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
--- a/strings/ctype-euc_kr.c	2006-03-23 14:29:27 +04:00
+++ b/strings/ctype-euc_kr.c	2007-10-04 10:19:59 +05:00
@@ -8614,12 +8614,12 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attri
 		 my_wc_t *pwc, const uchar *s, const uchar *e)
 {
   
-  int hi=s[0];
+  int hi;
   
   if (s >= e)
     return MY_CS_TOOSMALL;
   
-  if (hi<0x80)
+  if ((hi= s[0]) < 0x80)
   {
     pwc[0]=hi;
     return 1;
diff -Nrup a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
--- a/strings/ctype-gb2312.c	2006-03-23 14:29:27 +04:00
+++ b/strings/ctype-gb2312.c	2007-10-04 10:19:59 +05:00
@@ -5665,12 +5665,10 @@ my_mb_wc_gb2312(CHARSET_INFO *cs  __attr
 		my_wc_t *pwc, const uchar *s, const uchar *e){
   int hi;
   
-  hi=(int) s[0];
-  
   if (s >= e)
     return MY_CS_TOOSMALL;
   
-  if (hi<0x80)
+  if ((hi= s[0]) < 0x80)
   {
     pwc[0]=hi;
     return 1;
diff -Nrup a/strings/ctype-sjis.c b/strings/ctype-sjis.c
--- a/strings/ctype-sjis.c	2005-12-12 21:39:14 +04:00
+++ b/strings/ctype-sjis.c	2007-10-04 10:19:59 +05:00
@@ -4512,12 +4512,12 @@ mb:
 static int 
 my_mb_wc_sjis(CHARSET_INFO *cs  __attribute__((unused)),
 	      my_wc_t *pwc, const uchar *s, const uchar *e){
-  int hi=s[0];
+  int hi;
   
   if (s >= e)
     return MY_CS_TOOSMALL;
   
-  if (hi < 0x80)
+  if ((hi= s[0]) < 0x80)
   {
     pwc[0]=hi;
     return 1;
Thread
bk commit into 4.1 tree (ramil:1.2685) BUG#31069ramil4 Oct