diff --git a/client/mysql.cc b/client/mysql.cc index aadfa72fcf7..0d41ab928ec 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3292,6 +3292,9 @@ static int com_charset(String *, char *line) new_cs= get_charset_by_csname(param, MY_CS_PRIMARY, MYF(MY_WME)); if (new_cs) { + if (new_cs->mbminlen > 1) + return put_info("Character sets with mbminlen>1 are not supported", + INFO_ERROR, 0); charset_info= new_cs; mysql_set_character_set(&mysql, charset_info->csname); default_charset= (char *)charset_info->csname; diff --git a/mysql-test/main/mysql_not_windows.result b/mysql-test/main/mysql_not_windows.result index 96210a366a6..1f76491d5eb 100644 --- a/mysql-test/main/mysql_not_windows.result +++ b/mysql-test/main/mysql_not_windows.result @@ -11,3 +11,11 @@ X 3 ERROR 1300 (HY000): Invalid utf8 character string: 'test\xF0\x9F\x98\x81 ' ERROR 1300 (HY000): Invalid binary character string: 'test\xF0\x9F\x98\x81 ' +# Start of 10.5 tests +# +# MDEV-34090 Client allows to set character set to utf32 and crashes on the next command +# +SELECT "Success" AS c1; +c1 +Success +# End of 10.5 tests diff --git a/mysql-test/main/mysql_not_windows.test b/mysql-test/main/mysql_not_windows.test index 816160c4f3e..00d8ed8c4f9 100644 --- a/mysql-test/main/mysql_not_windows.test +++ b/mysql-test/main/mysql_not_windows.test @@ -29,3 +29,16 @@ exec $MYSQL test -e "$query"; --exec $MYSQL --default-character-set=utf8 -e "select 1" "test😁 " 2>&1 --error 1 --exec $MYSQL --default-character-set=binary -e "select 1" "test😁 " 2>&1 + + +--echo # Start of 10.5 tests + +--echo # +--echo # MDEV-34090 Client allows to set character set to utf32 and crashes on the next command +--echo # + +--error 1 +--exec $MYSQL test -e '\C utf32 ; SELECT 1' +SELECT "Success" AS c1; + +--echo # End of 10.5 tests