Commit b9adaeb4 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-28481 SIGSEGV in Lex_charset_collation_st::find_bin_collation

parent 40498498
...@@ -133,3 +133,22 @@ a c ...@@ -133,3 +133,22 @@ a c
DROP TABLE t1; DROP TABLE t1;
SET NAMES utf8; SET NAMES utf8;
# End of 10.5 tests # End of 10.5 tests
#
# Start of 10.9 tests
#
#
# MDEV-28481 SIGSEGV in Lex_charset_collation_st::find_bin_collation
#
SET SESSION collation_server=filename;
CREATE DATABASE db1;
USE db1;
CREATE TABLE t (c CHAR BINARY);
ERROR HY000: Unknown collation: 'filename_bin'
DROP DATABASE db1;
USE test;
SET NAMES latin1;
CREATE TABLE t1 (c CHAR BINARY) CHARACTER SET filename;
ERROR HY000: Unknown collation: 'filename_bin'
#
# End of 10.9 tests
#
...@@ -139,3 +139,27 @@ SET NAMES utf8; ...@@ -139,3 +139,27 @@ SET NAMES utf8;
--enable_ps_protocol --enable_ps_protocol
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo #
--echo # Start of 10.9 tests
--echo #
--echo #
--echo # MDEV-28481 SIGSEGV in Lex_charset_collation_st::find_bin_collation
--echo #
SET SESSION collation_server=filename;
CREATE DATABASE db1;
USE db1;
--error ER_UNKNOWN_COLLATION
CREATE TABLE t (c CHAR BINARY);
DROP DATABASE db1;
USE test;
SET NAMES latin1;
--error ER_UNKNOWN_COLLATION
CREATE TABLE t1 (c CHAR BINARY) CHARACTER SET filename;
--echo #
--echo # End of 10.9 tests
--echo #
...@@ -41,10 +41,11 @@ CHARSET_INFO *Lex_charset_collation_st::find_bin_collation(CHARSET_INFO *cs) ...@@ -41,10 +41,11 @@ CHARSET_INFO *Lex_charset_collation_st::find_bin_collation(CHARSET_INFO *cs)
return cs; return cs;
// CREATE TABLE t1 (a CHAR(10) BINARY) CHARACTER SET utf8mb4; // CREATE TABLE t1 (a CHAR(10) BINARY) CHARACTER SET utf8mb4;
const LEX_CSTRING &cs_name= cs->cs_name;
if (!(cs= get_charset_by_csname(cs->cs_name.str, MY_CS_BINSORT, MYF(0)))) if (!(cs= get_charset_by_csname(cs->cs_name.str, MY_CS_BINSORT, MYF(0))))
{ {
char tmp[65]; char tmp[65];
strxnmov(tmp, sizeof(tmp)-1, cs->cs_name.str, "_bin", NULL); strxnmov(tmp, sizeof(tmp)-1, cs_name.str, "_bin", NULL);
my_error(ER_UNKNOWN_COLLATION, MYF(0), tmp); my_error(ER_UNKNOWN_COLLATION, MYF(0), tmp);
} }
return cs; return cs;
......
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