Bug #301 MySQL (charset tis620) crash(signal11) when query partial index (CHAR)
Submitted: 16 Apr 2003 21:36 Modified: 17 Apr 2003 6:38
Reporter: Nartpong Ampornaramveth Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.12 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[16 Apr 2003 21:36] Nartpong Ampornaramveth
Description:
System: Linux RedHat7.2
Dual AthlonXP 1800+ , 2GB RAM
Mysql 4.0.12 (binary package on mysql.com)
----
I got the following error message and mysqld crash.
----
Version: '4.0.12-debug-debug'  socket: '/tmp/mysql.sock'  port: 3306
mysqld got signal 11;
----
when run mysqld with charset = tis620
( bin/safe_mysqld --default-character-set=tis620 )
and use query
mysql> select * from test.wbindex where poster like "Mr_fff2";

poster is char(20) 
and the table has index as
mysql> create index xx on wbindex (poster(10)); #partial index 10 from 20
----

It has no problem (mysqld won't crash) if 
1. the server's default-charset is default (latin1)
or
2. use index as 
mysql> create index xx on wbindex (poster);
----

ps. I have include trace file, error log, run query screen and testdata.mysql 
    to ftp://support.mysql.com/pub/mysql/secret/bug-index-tis620.zip

How to repeat:
use my testdata.mysql with the query 
mysql> select * from test.wbindex where poster like "Mr_fff2";

Suggested fix:
don't use tis620 charset with partial char index or
don't use partial char index.
[17 Apr 2003 6:38] MySQL Verification Team
Thank you for your bug report.

It helped us fix a crashing bug in 4.0.12. Fix will come in 4.0.13, but this is a patch:

===== strings/ctype-tis620.c 1.18 vs edited =====
*** /tmp/ctype-tis620.c-1.18-16197      Thu Mar 13 13:42:45 2003
--- edited/strings/ctype-tis620.c       Thu Apr 17 16:28:38 2003
***************
*** 491,497 ****
      return((uchar*) tstr);
    }
    pLeft4 = pRight4;*/
!   while(len--) {
      if(isldvowel(*p) && isconsnt(p[1])) {
        *pRight1++ = t_ctype[p[1]][0];
        *pRight2++ = t_ctype[p[1]][1];
--- 491,497 ----
      return((uchar*) tstr);
    }
    pLeft4 = pRight4;*/
!   while((len--)) {
      if(isldvowel(*p) && isconsnt(p[1])) {
        *pRight1++ = t_ctype[p[1]][0];
        *pRight2++ = t_ctype[p[1]][1];
***************
*** 501,507 ****
        *pRight2++ = t_ctype[*p][1];
        *pRight3++ = t_ctype[*p][2];
  /*    *pRight4++ = t_ctype[*p][3]; */
!       len--;
        p += 2;
      } else {
        *pRight1 = t_ctype[*p][0];
--- 501,508 ----
        *pRight2++ = t_ctype[*p][1];
        *pRight3++ = t_ctype[*p][2];
  /*    *pRight4++ = t_ctype[*p][3]; */
!       if (!(len--))
!       break;
        p += 2;
      } else {
        *pRight1 = t_ctype[*p][0];