summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-07-24 13:14:03 +0200
committerSergei Golubchik <serg@mariadb.org>2019-07-24 18:32:24 +0200
commit8ddb7e3eb71010decd5acc99aa98c82bbe0139aa (patch)
treea46cb1862af0d15a431c6dc07794c802ad3c33bc
parent5e8ab9b7af159cee6e954f62b6304c2c33b6f6e2 (diff)
downloadmariadb-git-8ddb7e3eb71010decd5acc99aa98c82bbe0139aa.tar.gz
Bug#27167197 USING ? IN INSTALL PLUGIN QUERY ABORTS DEBUG, AND HANGS OPTIMIZED SERVER
check_valid_path() uses my_strcspn() that cannot handle invalid characters properly. This is fixed by a big refactoring in 10.2 (MDEV-6353). For 5.5, let's simply swap tests, because check_string_char_length() rejects invalid characters just fine.
-rw-r--r--mysql-test/r/plugin.result8
-rw-r--r--mysql-test/t/plugin.test9
-rw-r--r--sql/sql_plugin.cc4
3 files changed, 19 insertions, 2 deletions
diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result
index 68ee682e562..65e993b2766 100644
--- a/mysql-test/r/plugin.result
+++ b/mysql-test/r/plugin.result
@@ -277,5 +277,13 @@ UNUSABLE
uninstall soname 'ha_example';
select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
plugin_name
+set names utf8;
+select convert('admin𝌆' using utf8);
+convert('admin𝌆' using utf8)
+admin
+Warnings:
+Warning 1300 Invalid utf8 character string: 'F09D8C'
+install plugin foo soname 'admin𝌆';
+ERROR HY000: No paths allowed for shared library
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 0cb25c6249d..05347d221a0 100644
--- a/mysql-test/t/plugin.test
+++ b/mysql-test/t/plugin.test
@@ -225,8 +225,17 @@ uninstall soname 'ha_example';
select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
#
+#
+#
+set names utf8;
+select convert('admin𝌆' using utf8);
+--error ER_UDF_NO_PATHS
+install plugin foo soname 'admin𝌆';
+
+#
# 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 91d0a4393c5..a90c7558045 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -736,9 +736,9 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
This is done to ensure that only approved libraries from the
plugin directory are used (to make this even remotely secure).
*/
- if (check_valid_path(dl->str, dl->length) ||
- check_string_char_length((LEX_STRING *) dl, "", NAME_CHAR_LEN,
+ if (check_string_char_length((LEX_STRING *) dl, "", NAME_CHAR_LEN,
system_charset_info, 1) ||
+ check_valid_path(dl->str, dl->length) ||
plugin_dir_len + dl->length + 1 >= FN_REFLEN)
{
report_error(report, ER_UDF_NO_PATHS);