Commit 186e6cb2 authored by bar@mysql.com's avatar bar@mysql.com

ctype_ucs.result, ctype_ucs.test, item.cc:

  #5024 [Ver]: Server crashes with queries on fields with certain charset/collation settings
parent 3fdc2999
...@@ -464,3 +464,9 @@ HEX(a) ...@@ -464,3 +464,9 @@ HEX(a)
AAAA AAAA
000AAAAA 000AAAAA
DROP TABLE t1; DROP TABLE t1;
create table t1 (s1 char character set `ucs2` collate `ucs2_czech_ci`);
insert into t1 values ('0'),('1'),('2'),('a'),('b'),('c');
select s1 from t1 where s1 > 'a' order by s1;
s1
b
c
...@@ -293,3 +293,14 @@ SELECT HEX(a) FROM t1; ...@@ -293,3 +293,14 @@ SELECT HEX(a) FROM t1;
DROP TABLE t1; DROP TABLE t1;
-- the same should be also done with enum and set -- the same should be also done with enum and set
#
# Bug #5024 Server crashes with queries on fields
# with certain charset/collation settings
#
create table t1 (s1 char character set `ucs2` collate `ucs2_czech_ci`);
insert into t1 values ('0'),('1'),('2'),('a'),('b'),('c');
select s1 from t1 where s1 > 'a' order by s1;
...@@ -176,11 +176,16 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs) ...@@ -176,11 +176,16 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
name= (char*) str; name= (char*) str;
return; return;
} }
if (cs->ctype)
{
// This will probably need a better implementation in the future:
// a function in CHARSET_INFO structure.
while (length && !my_isgraph(cs,*str)) while (length && !my_isgraph(cs,*str))
{ // Fix problem with yacc { // Fix problem with yacc
length--; length--;
str++; str++;
} }
}
if (!my_charset_same(cs, system_charset_info)) if (!my_charset_same(cs, system_charset_info))
{ {
uint32 res_length; uint32 res_length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment