Commit 47aaf9c4 authored by Alexander Barkov's avatar Alexander Barkov

Bug#51675 Server crashes on inserting 4 byte char. after ALTER TABLE to 'utf8mb4'

Bug#51676 Server crashes on SELECT, ORDER BY on 'utf8mb4' column
An additional fix. We should use 0xFFFD as a weight for supplementary
characters, not the "weight for character U+FFFD".
parent d6edcf75
......@@ -2456,16 +2456,16 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t1 ORDER BY 1;
subject p
𐐀 NULL
abc𐐀def NULL
𐐀 NULL
SELECT hex(subject), length(subject), char_length(subject), octet_length(subject) FROM t1 ORDER BY 1;
hex(subject) length(subject) char_length(subject) octet_length(subject)
616263F0909080646566 10 7 10
F0909080 4 1 4
SELECT subject FROM t1 ORDER BY 1;
subject
𐐀
abc𐐀def
𐐀
DROP TABLE t1;
#
# End of 5.5 tests
......
......@@ -6983,11 +6983,18 @@ static int my_uca_scanner_next_any(my_uca_scanner *scanner)
scanner->send)) <= 0))
return -1;
if (wc > 0xFFFF)
wc= MY_CS_REPLACEMENT_CHARACTER;
scanner->page= wc >> 8;
scanner->code= wc & 0xFF;
scanner->sbeg+= mb_len;
if (wc > 0xFFFF)
{
/* Return 0xFFFD as weight for all characters outside BMP */
scanner->wbeg= nochar;
return 0xFFFD;
}
else
{
scanner->page= wc >> 8;
scanner->code= wc & 0xFF;
}
if (scanner->contractions && !scanner->page &&
(scanner->code > 0x40) && (scanner->code < 0x80))
......
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