Commit a388efbf authored by Alexander Barkov's avatar Alexander Barkov

An additional fix for WL#1213 4-byte UTF8

- Fixing crash on attempt to create a fulltext index with an utf8mb4 column
- fixing wrong border width  for supplementary characters in mysql client:

  mysql --default-character-set=utf8mb4 -e "select concat(_utf32 0x20000,'a')"
parent 99d1b2bd
......@@ -2438,6 +2438,9 @@ t1 CREATE TABLE `t1` (
INSERT INTO t1(subject) VALUES ('abcd');
INSERT INTO t1(subject) VALUES(x'f0909080');
DROP TABLE t1;
CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4, FULLTEXT INDEX(a));
INSERT INTO t1 VALUES (0xF0A08080 /* U+20000 */ );
DROP TABLE t1;
#
# Bug #51676 Server crashes on SELECT, ORDER BY on 'utf8mb4' column
#
......
......@@ -1763,6 +1763,13 @@ INSERT INTO t1(subject) VALUES ('abcd');
INSERT INTO t1(subject) VALUES(x'f0909080');
DROP TABLE t1;
#
# Make sure fulltext does not crash on supplementary characters
#
CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4, FULLTEXT INDEX(a));
INSERT INTO t1 VALUES (0xF0A08080 /* U+20000 */ );
DROP TABLE t1;
--echo #
--echo # Bug #51676 Server crashes on SELECT, ORDER BY on 'utf8mb4' column
--echo #
......
......@@ -1123,8 +1123,16 @@ size_t my_numcells_mb(CHARSET_INFO *cs, const char *b, const char *e)
continue;
}
b+= mb_len;
pg= (wc >> 8) & 0xFF;
clen+= utr11_data[pg].p ? utr11_data[pg].p[wc & 0xFF] : utr11_data[pg].page;
if (wc > 0xFFFF)
{
if (wc >= 0x20000 && wc <= 0x3FFFD) /* CJK Ideograph Extension B, C */
clen+= 1;
}
else
{
pg= (wc >> 8) & 0xFF;
clen+= utr11_data[pg].p ? utr11_data[pg].p[wc & 0xFF] : utr11_data[pg].page;
}
clen++;
}
return clen;
......@@ -1136,7 +1144,7 @@ int my_mb_ctype_mb(CHARSET_INFO *cs, int *ctype,
{
my_wc_t wc;
int res= cs->cset->mb_wc(cs, &wc, s, e);
if (res <= 0)
if (res <= 0 || wc > 0xFFFF)
*ctype= 0;
else
*ctype= my_uni_ctype[wc>>8].ctype ?
......
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