Commit 0e25a8b4 authored by Thirunarayanan Balathandayuthapani's avatar Thirunarayanan Balathandayuthapani Committed by Marko Mäkelä

MDEV-21344: Uninitialized tbl_buf in dict_acquire_mdl_shared<false>()

dict_table_t::parse_name(): Properly calculate the *tbl_name_len.

A failure was easily repeatable during the test
innodb.innodb-alter-debug for the table name test.① ("test/@2460").
The UTF-8 representation of the U+2460 is only 3 bytes "\xe2\x91\xa0"
while the filename-safe encoded counterpart of it in dict_table_t::name
is 5 bytes "@2460".

This bug, introduced by commit ea37b144
(MDEV-16678), could cause a purge task to hang.
parent fde1589f
......@@ -2,7 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2019, MariaDB Corporation.
Copyright (c) 2013, 2020, 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
......@@ -754,7 +754,6 @@ bool dict_table_t::parse_name(char (&db_name)[NAME_LEN + 1],
mutex_exit(&dict_sys.mutex);
*db_name_len= db_len;
*tbl_name_len= tbl_len;
filename_to_tablename(db_buf, db_name, MAX_DATABASE_NAME_LEN + 1, true);
......@@ -763,12 +762,10 @@ bool dict_table_t::parse_name(char (&db_name)[NAME_LEN + 1],
return false;
if (char* is_part= strchr(tbl_buf, '#'))
{
*is_part = '\0';
*tbl_name_len= is_part - tbl_buf;
}
*is_part= '\0';
filename_to_tablename(tbl_buf, tbl_name, MAX_TABLE_NAME_LEN + 1, true);
*tbl_name_len= strlen(tbl_name);
return true;
}
......
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