Commit 16987e1c authored by unknown's avatar unknown

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

  #5024 [Ver]: Server crashes with queries on fields with certain charset/collation settings


sql/item.cc:
  #5024 [Ver]: Server crashes with queries on fields with certain charset/collation settings
mysql-test/t/ctype_ucs.test:
  #5024 [Ver]: Server crashes with queries on fields with certain charset/collation settings
mysql-test/r/ctype_ucs.result:
  #5024 [Ver]: Server crashes with queries on fields with certain charset/collation settings
parent fe61e5d2
...@@ -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,10 +176,15 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs) ...@@ -176,10 +176,15 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
name= (char*) str; name= (char*) str;
return; return;
} }
while (length && !my_isgraph(cs,*str)) if (cs->ctype)
{ // Fix problem with yacc {
length--; // This will probably need a better implementation in the future:
str++; // a function in CHARSET_INFO structure.
while (length && !my_isgraph(cs,*str))
{ // Fix problem with yacc
length--;
str++;
}
} }
if (!my_charset_same(cs, system_charset_info)) if (!my_charset_same(cs, system_charset_info))
{ {
......
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