From 5e8ab9b7af159cee6e954f62b6304c2c33b6f6e2 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 16 Apr 2019 09:33:02 +0530 Subject: [PATCH] Bug#27302459: EMPTY VALUE IN MYSQL.PLUGIN TABLE CAUSES SERVER TO EXIT ON STARTUP Description:- During server startup, the server exits if the 'mysql.plugin' system table has any rows with empty value for the field 'name' (plugin name). --- mysql-test/r/plugin.result | 2 ++ mysql-test/t/plugin.test | 6 ++++++ sql/sql_plugin.cc | 3 +++ 3 files changed, 11 insertions(+) diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result index 4fb4986d0fd..68ee682e562 100644 --- a/mysql-test/r/plugin.result +++ b/mysql-test/r/plugin.result @@ -277,3 +277,5 @@ UNUSABLE uninstall soname 'ha_example'; select plugin_name from information_schema.plugins where plugin_library like 'ha_example%'; plugin_name +insert mysql.plugin values (); +delete from mysql.plugin where name = ''; diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index c61a9239218..0cb25c6249d 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -224,3 +224,9 @@ select plugin_name from information_schema.plugins where plugin_library like 'ha uninstall soname 'ha_example'; select plugin_name from information_schema.plugins where plugin_library like 'ha_example%'; +# +# Bug#27302459: EMPTY VALUE IN MYSQL.PLUGIN TABLE CAUSES SERVER TO EXIT ON STARTUP +# +insert mysql.plugin values (); +source include/restart_mysqld.inc; +delete from mysql.plugin where name = ''; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 46df991639e..91d0a4393c5 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1781,6 +1781,9 @@ static void plugin_load(MEM_ROOT *tmp_root) LEX_STRING name= {(char *)str_name.ptr(), str_name.length()}; LEX_STRING dl= {(char *)str_dl.ptr(), str_dl.length()}; + if (!name.length || !dl.length) + continue; + /* there're no other threads running yet, so we don't need a mutex. but plugin_add() before is designed to work in multi-threaded