Skip to content

Commit

Permalink
MDEV-27521 SIGSEGV in spider_parse_connect_info in MDEV-27106 branch
Browse files Browse the repository at this point in the history
Add NULL check to SPIDER_OPTION_STR_LIST.
  • Loading branch information
nayuta-yanagisawa committed Jan 24, 2022
1 parent 0599dd9 commit 5595ed9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion storage/spider/spd_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2015,7 +2015,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)= \
Expand Down

0 comments on commit 5595ed9

Please sign in to comment.