Bug #68805 client crashes after "charset utf16"
Submitted: 28 Mar 2013 16:30 Modified: 6 Aug 2013 8:42
Reporter: dan d Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.6.13 OS:Any (Linux and Windows)
Assigned to: CPU Architecture:Any
Tags: charset, crash, utf16

[28 Mar 2013 16:30] dan d
Description:
After trying to set the charset to utf16, the mysql client crashes.
The trace shows this line:

client.c:   667: cli_read_query_result: error: Got error: 1231/42000 (Variable 'character_set_client' can't be set to the value of 'utf16'

(The same crash happen when I try to set the utf32 charset, although trace shows an other error before:
my_mess.c:    22: my_message_stderr: enter: message: Character set 'utf' is not a compiled character set and is not specified in the '/home/dan/mysql5.6.10/share/charsets/Index.xml' file
)

Tested with:
 - MySQL 5.6.10 Linux (debian 6 x86_64) & Windows 7 (x86_64)
 - MySQL 5.5.28 Windows 7 (x86_64)

mysql> status
--------------
./bin/mysql  Ver 14.14 Distrib 5.6.10, for Linux (x86_64) using  EditLine wrapper

Connection id:		29
Current database:	
Current user:		dan@q9550
SSL:			Not in use
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server version:		5.6.10-log MySQL Community Server (GPL)
Protocol version:	10
Connection:		192.168.1.10 via TCP/IP
Server characterset:	latin1
Db     characterset:	latin1
Client characterset:	utf8
Conn.  characterset:	utf8
TCP port:		3307
Uptime:			5 hours 56 min 34 sec

Threads: 3  Questions: 47998  Slow queries: 117  Opens: 962  Flush tables: 1  Open tables: 256  Queries per second avg: 2.243
--------------

How to repeat:
1. Connect to the server with the command line client (mysql)

2. Change the actual charset to utf16:
mysql> charset utf16
Charset changed

3. Issue any command (local is sufficient)
mysql> help
Segmentation fault

Suggested fix:
Display an error message instead of just crashing.
[28 Mar 2013 16:33] dan d
debug trace showing the error that the charset can not be set

Attachment: client.trace (application/octet-stream, text), 14.27 KiB.

[29 Mar 2013 8:29] MySQL Verification Team
Hello Dan,

Thank you for the report.
Verified as described.

Thanks,
Umesh
[29 Mar 2013 8:30] MySQL Verification Team
trace..

Attachment: 68805.txt (text/plain), 31.04 KiB.

[1 Apr 2013 17:26] MySQL Verification Team
Call stack:

mysql.exe!find_command(char * name=0x0000000001cde070)  Line 2274 	mysql.exe!read_and_execute(bool interactive=true)  Line 2167
mysql.exe!main(int argc=4, char * * argv=0x0000000001df2670)  Line 1396
mysql.exe!__tmainCRTStartup()  Line 278
mysql.exe!mainCRTStartup()  Line 189

Crash is here:

while (my_isspace(charset_info, *name))
000000013FA53913  mov         rax,qword ptr [charset_info (13FCB2138h)]  
000000013FA5391A  mov         rax,qword ptr [rax+30h]  
000000013FA5391E  mov         rcx,qword ptr [name]  
000000013FA53926  movzx       ecx,byte ptr [rcx]        
000000013FA53929  movzx       eax,byte ptr [rax+rcx+1]  <----------here
[6 Aug 2013 8:42] dan d
After 130 days, I was wondering, how much time does the "Triage" normally need?

Just verified the presence of the bug in version 5.6.13-winx64:

mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------+
| Variable_name           | Value                        |
+-------------------------+------------------------------+
| innodb_version          | 5.6.13                       |
| protocol_version        | 10                           |
| slave_type_conversions  |                              |
| version                 | 5.6.13-log                   |
| version_comment         | MySQL Community Server (GPL) |
| version_compile_machine | x86_64                       |
| version_compile_os      | Win64                        |
+-------------------------+------------------------------+
7 rows in set (0.00 sec)

mysql> charset utf16;
???????d
??? help

E:\mysql-5.6.13-winx64>