Commit 16987e1c authored by unknown's avatar unknown
Browse files

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
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -464,3 +464,9 @@ HEX(a)
AAAA
000AAAAA
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
+11 −0
Original line number Diff line number Diff line
@@ -293,3 +293,14 @@ SELECT HEX(a) FROM t1;
DROP TABLE t1;

-- 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;
+9 −4
Original line number Diff line number Diff line
@@ -176,11 +176,16 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
    name= (char*) str;
    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))
    {						// Fix problem with yacc
      length--;
      str++;
    }
  }
  if (!my_charset_same(cs, system_charset_info))
  {
    uint32 res_length;