summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-08-30 10:59:31 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-08-30 10:59:31 +0300
commitb260903832456dcad882e01a10cdcd48dfd2b0dc (patch)
tree19b9b9f8fa0a0450473eef5815a316754f460cd7 /storage
parent0d1de5e1d19f1e96058ab5948e184f22e7bdd908 (diff)
downloadmariadb-git-b260903832456dcad882e01a10cdcd48dfd2b0dc.tar.gz
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.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/fil/fil0fil.cc2
-rw-r--r--storage/innobase/trx/trx0rec.cc6
2 files changed, 4 insertions, 4 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index a196303c39f..5d9f80eda70 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -2105,7 +2105,7 @@ fil_op_write_log(
case MLOG_FILE_RENAME2:
ut_ad(strchr(new_path, OS_PATH_SEPARATOR) != NULL);
len = strlen(new_path) + 1;
- log_ptr = mlog_open(mtr, 2 + len);
+ log_ptr = mlog_open(mtr, 2);
ut_a(log_ptr);
mach_write_to_2(log_ptr, len);
log_ptr += 2;
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index e011b3f5d8e..d7ec2a38f19 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2019, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2021, MariaDB Corporation.
+Copyright (c) 2017, 2022, MariaDB Corporation.
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 the Free Software
@@ -1867,9 +1867,9 @@ trx_undo_page_report_rename(trx_t* trx, const dict_table_t* table,
byte* start = block->frame + first_free;
size_t len = strlen(table->name.m_name);
const size_t fixed = 2 + 1 + 11 + 11 + 2;
- ut_ad(len <= NAME_LEN * 2 + 1);
+ ut_ad(len <= NAME_CHAR_LEN * 5 * 2 + 1);
/* The -10 is used in trx_undo_left() */
- compile_time_assert((NAME_LEN * 1) * 2 + fixed
+ compile_time_assert(NAME_CHAR_LEN * 5 * 2 + fixed
+ TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE
< UNIV_PAGE_SIZE_MIN - 10 - FIL_PAGE_DATA_END);