Below is the list of changes that have just been committed into a local
6.0 repository of bar. When bar 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, 2008-05-02 20:53:40+05:00, bar@stripped +3 -0
Bug#32394 Character sets: crash if comparison with 0xfffd
Problem: when converting from "binary" to "real multi-byte"
character sets, strings were not left-padded to correct length.
Fix: force installing Item_func_conv_charset() when conversion
from "binary" to "real multi-byte" happens. Example:
In case of utf32: 0x61 is now padded to 0x00000061,
previously it was not padded in some cases.
mysql-test/r/ctype_utf32.result@stripped, 2008-05-02 20:53:26+05:00, bar@stripped +15 -0
Adding tests
mysql-test/t/ctype_utf32.test@stripped, 2008-05-02 20:53:26+05:00, bar@stripped +11 -0
Adding tests
sql/item.cc@stripped, 2008-05-02 20:53:26+05:00, bar@stripped +2 -2
Fixing problems with auto-extending for "real" multibyte character
sets, e.g. in case of utf32 we need to left-pad 0x61 to 0x00000061.
1. Pass 1 as length to needs_comversion(), to force creating
Item_func_conv_charset() for padding purposes.
2. Allow creating safe converters at prepare time.
diff -Nrup a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
--- a/mysql-test/r/ctype_utf32.result 2008-04-01 20:03:41 +05:00
+++ b/mysql-test/r/ctype_utf32.result 2008-05-02 20:53:26 +05:00
@@ -934,6 +934,21 @@ insert into t1 values (0x001000000011000
Warnings:
Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column 'utf32' at row 1
drop table t1;
+select _utf32'a' collate utf32_general_ci = 0xfffd;
+_utf32'a' collate utf32_general_ci = 0xfffd
+0
+select hex(concat(_utf32 0x0410 collate utf32_general_ci, 0x61));
+hex(concat(_utf32 0x0410 collate utf32_general_ci, 0x61))
+0000041000000061
+create table t1 (s1 varchar(5) character set utf32);
+insert into t1 values (0xfffd);
+select case when s1 = 0xfffd then 1 else 0 end from t1;
+case when s1 = 0xfffd then 1 else 0 end
+1
+select hex(s1) from t1 where s1 = 0xfffd;
+hex(s1)
+0000FFFD
+drop table t1;
create table t1 (a char(10)) character set utf32;
insert into t1 values ('a ');
select hex(a) from t1;
diff -Nrup a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test
--- a/mysql-test/t/ctype_utf32.test 2008-04-01 20:03:41 +05:00
+++ b/mysql-test/t/ctype_utf32.test 2008-05-02 20:53:26 +05:00
@@ -613,6 +613,17 @@ insert into t1 values (0x001000000011000
drop table t1;
#
+# Bug#32394 Character sets: crash if comparison with 0xfffd
+#
+select _utf32'a' collate utf32_general_ci = 0xfffd;
+select hex(concat(_utf32 0x0410 collate utf32_general_ci, 0x61));
+create table t1 (s1 varchar(5) character set utf32);
+insert into t1 values (0xfffd);
+select case when s1 = 0xfffd then 1 else 0 end from t1;
+select hex(s1) from t1 where s1 = 0xfffd;
+drop table t1;
+
+#
# Testing cs->cset->lengthsp()
#
create table t1 (a char(10)) character set utf32;
diff -Nrup a/sql/item.cc b/sql/item.cc
--- a/sql/item.cc 2008-04-01 18:44:52 +05:00
+++ b/sql/item.cc 2008-05-02 20:53:26 +05:00
@@ -847,7 +847,7 @@ Item *Item_param::safe_charset_converter
cnvitem->max_length= cnvitem->str_value.numchars() * tocs->mbmaxlen;
return cnvitem;
}
- return NULL;
+ return Item::safe_charset_converter(tocs);
}
@@ -1695,7 +1695,7 @@ bool agg_item_charsets(DTCollation &coll
{
Item* conv;
uint32 dummy_offset;
- if (!String::needs_conversion(0, (*arg)->collation.collation,
+ if (!String::needs_conversion(1, (*arg)->collation.collation,
coll.collation,
&dummy_offset))
continue;
| Thread |
|---|
| • bk commit into 6.0 tree (bar:1.2622) BUG#32394 | bar | 2 May |