Bug #6268 Server crash on LIKE with UTF-8 character set
Submitted: 26 Oct 2004 18:08 Modified: 21 Feb 2005 10:27
Reporter: Ingo Strüwing Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.2 OS:Linux (Linux)
Assigned to: Assigned Account CPU Architecture:Any

[26 Oct 2004 18:08] Ingo Strüwing
Crash on using LIKE with '%something%' on UTF-8 column of system table 'mysql.user'.

#3  <signal handler called>
#4  0x084b77f3 in my_wildcmp_mb (...) at ctype-mb.c
#5  0x084b82aa in my_wildcmp_mb_bin (...) at ctype-mb.c
#6  0x081440d3 in Item_func_like::val_int (...) at sql_string.h
#7  0x081f8655 in sub_select (...) at sql_select.cc
#8  0x081f8136 in do_select (...) at sql_select.cc

In the code:

#define likeconv(s,A) (uchar) (s)->sort_order[(uchar) (A)]
if (str == str_end || likeconv(cs,*wildstr++) != likeconv(cs,*str++))

charset->sort_order == NULL
charset->csname == "utf8"

How to repeat:
grant all on t1 to 'mysqltest_1';
select host,user from mysql.user where user like '%mysqltest_1%';

Suggested fix:
Set a default sort order for the system table(s).
[21 Feb 2005 10:27] Alexander Barkov
Duplicate with bug#5397