1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-25109 Server crashes in sp_name::sp_name upon invalid data in mysql.proc

don't try to lowercase a db name if it's zero-length.
(empty_lex_str is not writable, even db.str[0]=0 will fail)
This commit is contained in:
Sergei Golubchik
2021-04-27 13:05:13 +02:00
parent 2e279962e9
commit 64b7433709
3 changed files with 30 additions and 1 deletions

View File

@ -148,3 +148,19 @@ drop table t1;
# #
# End of 10.2 tests # End of 10.2 tests
# #
#
# MDEV-25109 Server crashes in sp_name::sp_name upon invalid data in mysql.proc
#
call mtr.add_suppression("Stored routine ''.'': invalid value in column");
insert ignore into mysql.proc () values ();
Warnings:
Warning 1364 Field 'param_list' doesn't have a default value
Warning 1364 Field 'returns' doesn't have a default value
Warning 1364 Field 'body' doesn't have a default value
Warning 1364 Field 'comment' doesn't have a default value
show function status;
ERROR 42000: Incorrect routine name ''
delete from mysql.proc where name = '';
#
# End of 10.3 tests
#

View File

@ -126,3 +126,16 @@ drop table t1;
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #
--echo #
--echo # MDEV-25109 Server crashes in sp_name::sp_name upon invalid data in mysql.proc
--echo #
call mtr.add_suppression("Stored routine ''.'': invalid value in column");
insert ignore into mysql.proc () values ();
--error ER_SP_WRONG_NAME
show function status;
delete from mysql.proc where name = '';
--echo #
--echo # End of 10.3 tests
--echo #

View File

@ -111,7 +111,7 @@ public:
bool use_explicit_name) bool use_explicit_name)
: Database_qualified_name(db, name), m_explicit_name(use_explicit_name) : Database_qualified_name(db, name), m_explicit_name(use_explicit_name)
{ {
if (lower_case_table_names && m_db.str) if (lower_case_table_names && m_db.length)
m_db.length= my_casedn_str(files_charset_info, (char*) m_db.str); m_db.length= my_casedn_str(files_charset_info, (char*) m_db.str);
} }