From 827b049e1e7df204feb744a270b4dca619a61de1 Mon Sep 17 00:00:00 2001 From: tmokmss Date: Sun, 5 Jun 2022 08:04:18 +0000 Subject: MDEV-18873 Server crashes in Compare_identifiers::operator or in my_strcasecmp_utf8 upon ADD PERIOD IF NOT EXISTS with empty name empty identifier specified as `` ends up with a NULL LEX_CSTRING::str in lexer. This is not considered correct in upper layers, for example in Compare_identifiers::operator(). Empty column name is usually avoided by a check_column_name() call while parsing, and period name matches the column name completely. Hence, this fix uses the mentioned call for verification, too. --- sql/table.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sql/table.cc') diff --git a/sql/table.cc b/sql/table.cc index 7957f2da593..1a30809cde9 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4918,6 +4918,12 @@ bool check_column_name(const char *name) } +bool check_period_name(const char *name) +{ + return check_column_name(name); +} + + /** Checks whether a table is intact. Should be done *just* after the table has been opened. -- cgit v1.2.1 From b260903832456dcad882e01a10cdcd48dfd2b0dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 30 Aug 2022 10:59:31 +0300 Subject: MDEV-29258 Failing assertion for name length on RENAME TABLE trx_undo_page_report_rename(): Use the correct maximum length of a table name. Both the database name and the table name can be up to NAME_CHAR_LEN (64 characters) times 5 bytes per character in the my_charset_filename encoding. They are not encoded in UTF-8! fil_op_write_log(): Reserve the correct amount of log buffer for a rename operation. The file name will be appended by mlog_catenate_string(). rename_file_ext(): Reserve a large enough buffer for the file names. --- sql/table.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sql/table.cc') diff --git a/sql/table.cc b/sql/table.cc index 64fb3150a39..506195127b2 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2008, 2021, MariaDB + Copyright (c) 2008, 2022, MariaDB 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 @@ -4197,7 +4197,8 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table) int rename_file_ext(const char * from,const char * to,const char * ext) { - char from_b[FN_REFLEN],to_b[FN_REFLEN]; + /* Reserve space for ./databasename/tablename.frm + NUL byte */ + char from_b[2 + FN_REFLEN + 4 + 1], to_b[2 + FN_REFLEN + 4 + 1]; (void) strxmov(from_b,from,ext,NullS); (void) strxmov(to_b,to,ext,NullS); return mysql_file_rename(key_file_frm, from_b, to_b, MYF(0)); -- cgit v1.2.1