Commit aeab9d6b authored by Arun Kuruvila's avatar Arun Kuruvila

Bug#23303391: HANDLE_FATAL_SIGNAL (SIG=11) IN ALLOC_QUERY

              USING CHARACTER-SET-SERVER=UTF16

This is a backport of Bug#15985752 to mysql-5.5
parent 7603ac53
......@@ -3482,9 +3482,24 @@ static int init_common_variables()
/* Set collactions that depends on the default collation */
global_system_variables.collation_server= default_charset_info;
global_system_variables.collation_database= default_charset_info;
if (is_supported_parser_charset(default_charset_info))
{
global_system_variables.collation_connection= default_charset_info;
global_system_variables.character_set_results= default_charset_info;
global_system_variables.character_set_client= default_charset_info;
}
else
{
sql_print_information("'%s' can not be used as client character set. "
"'%s' will be used as default client character set.",
default_charset_info->csname,
my_charset_latin1.csname);
global_system_variables.collation_connection= &my_charset_latin1;
global_system_variables.character_set_results= &my_charset_latin1;
global_system_variables.character_set_client= &my_charset_latin1;
}
if (!(character_set_filesystem=
get_charset_by_csname(character_set_filesystem_name,
MY_CS_PRIMARY, MYF(MY_WME))))
......
......@@ -8789,7 +8789,10 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
{
mpvio->client_capabilities= uint4korr(end);
mpvio->max_client_packet_length= 0xfffff;
charset_code= default_charset_info->number;
charset_code= global_system_variables.character_set_client->number;
sql_print_warning("Client failed to provide its character set. "
"'%s' will be used as client character set.",
global_system_variables.character_set_client->csname);
if (mpvio->charset_adapter->init_client_charset(charset_code))
return packet_error;
goto skip_to_ssl;
......@@ -8826,7 +8829,10 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
Old clients didn't have their own charset. Instead the assumption
was that they used what ever the server used.
*/
charset_code= default_charset_info->number;
charset_code= global_system_variables.character_set_client->number;
sql_print_warning("Client failed to provide its character set. "
"'%s' will be used as client character set.",
global_system_variables.character_set_client->csname);
}
DBUG_EXECUTE_IF("host_error_charset",
{
......
/*
Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -431,6 +431,14 @@ bool thd_init_client_charset(THD *thd, uint cs_number)
global_system_variables.character_set_client->name,
cs->name))
{
if (!is_supported_parser_charset(
global_system_variables.character_set_client))
{
/* Disallow non-supported parser character sets: UCS2, UTF16, UTF32 */
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "character_set_client",
global_system_variables.character_set_client->csname);
return true;
}
thd->variables.character_set_client=
global_system_variables.character_set_client;
thd->variables.collation_connection=
......
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