From 1bfeac1aef7025d8e13d92ec85c2bacf1503b794 Mon Sep 17 00:00:00 2001 From: Nayuta Yanagisawa Date: Wed, 19 Jan 2022 14:17:36 +0900 Subject: MDEV-27521 SIGSEGV in spider_parse_connect_info in MDEV-27106 branch Add NULL check to SPIDER_OPTION_STR_LIST. --- .../mysql-test/spider/feature/r/engine_defined_attributes.result | 7 +++++++ .../mysql-test/spider/feature/t/engine_defined_attributes.test | 8 ++++++++ storage/spider/spd_table.cc | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/storage/spider/mysql-test/spider/feature/r/engine_defined_attributes.result b/storage/spider/mysql-test/spider/feature/r/engine_defined_attributes.result index 866d9c78b27..2b63fb3ee53 100644 --- a/storage/spider/mysql-test/spider/feature/r/engine_defined_attributes.result +++ b/storage/spider/mysql-test/spider/feature/r/engine_defined_attributes.result @@ -209,6 +209,13 @@ REMOTE_SERVER="s_2_2" REMOTE_DATABASE="auto_test_remote2" SELECT * FROM tbl_a; a b DROP TABLE tbl_a; +CREATE TABLE tbl_a ( +a INT +) ENGINE=Spider DEFAULT CHARSET=utf8 +PARTITION BY HASH (a) PARTITIONS 2; +SELECT * FROM tbl_a; +ERROR HY000: Unable to connect to foreign data source: localhost +DROP TABLE tbl_a; connection child2_1; DROP DATABASE auto_test_remote; connection child2_2; diff --git a/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.test b/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.test index c42a9b671c4..e3fef7cb6d6 100644 --- a/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.test +++ b/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.test @@ -194,6 +194,14 @@ PARTITION BY RANGE (a) ( SELECT * FROM tbl_a; DROP TABLE tbl_a; +eval CREATE TABLE tbl_a ( + a INT +) $MASTER_1_ENGINE $MASTER_1_CHARSET +PARTITION BY HASH (a) PARTITIONS 2; +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +SELECT * FROM tbl_a; +DROP TABLE tbl_a; + --connection child2_1 DROP DATABASE auto_test_remote; diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 1c7bbfb3f73..5c41bd562bc 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -2029,7 +2029,7 @@ int st_spider_param_string_parse::print_param_error() corresponding attribute of SPIDER_SHARE. */ #define SPIDER_OPTION_STR_LIST(title_name, option_name, param_name) \ - if (option_struct->option_name) \ + if (option_struct && option_struct->option_name) \ { \ DBUG_PRINT("info", ("spider " title_name " start overwrite")); \ share->SPIDER_PARAM_STR_CHARLEN(param_name)= \ -- cgit v1.2.1