Commit a5ef74e7 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-27195 SIGSEGV in Table_scope_and_contents_source_st::vers_check_system_fields

The old code erroneously used default_charset_info to compare field names.
default_charset_info can point to any arbitrary collation,
including ucs2*, utf16*, utf32*, including those that do not
support strcasecmp().

my_charset_utf8mb4_unicode_ci, which is used in this scenario:

CREATE TABLE t1 ENGINE=InnoDB WITH SYSTEM VERSIONING AS SELECT 0;

does not support strcasecmp().

Fixing the code to use Lex_ident::streq(), which uses
system_charset_info instead of default_charset_info.
parent 3b33593f
--character-set-server=utf8mb4,latin1 --collation-server=utf8mb4_unicode_ci
#
# Start of 10.3 tests
#
#
# MDEV-27195 SIGSEGV in Table_scope_and_contents_source_st::vers_check_system_fields
#
CREATE TABLE t1 ENGINE=MyISAM WITH SYSTEM VERSIONING AS SELECT 0;
DROP TABLE t1;
#
# End of 10.3 tests
#
--echo #
--echo # Start of 10.3 tests
--echo #
--echo #
--echo # MDEV-27195 SIGSEGV in Table_scope_and_contents_source_st::vers_check_system_fields
--echo #
CREATE TABLE t1 ENGINE=MyISAM WITH SYSTEM VERSIONING AS SELECT 0;
DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #
......@@ -7264,8 +7264,7 @@ bool Table_scope_and_contents_source_st::vers_check_system_fields(
{
List_iterator<Create_field> dup_it(alter_info->create_list);
for (Create_field *dup= dup_it++; !is_dup && dup != f; dup= dup_it++)
is_dup= my_strcasecmp(default_charset_info,
dup->field_name.str, f->field_name.str) == 0;
is_dup= Lex_ident(dup->field_name).streq(f->field_name);
}
if (!(f->flags & VERS_UPDATE_UNVERSIONED_FLAG) && !is_dup)
......
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