Commit 4bc7c03b authored by Nayuta Yanagisawa's avatar Nayuta Yanagisawa

MDEV-29011 Server crash in spider_db_open_item_cond with XOR operator

Item_func_xor and Item_cond are both derived class of Item_bool_func.
Spider converts *Item_func_xor to *Item_cond and then calls the member
function argument_list(), which Item_func_xor does not implement.
parent 8c8bd4be
#
# MDEV-29011 Server crash in spider_db_open_item_cond with XOR operator
#
for master_1
for child2
child2_1
child2_2
child2_3
for child3
connection child2_1;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
CREATE TABLE tbl_a (
a INT,
b INT
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO tbl_a VALUES (0, 0), (0, 1), (1, 0), (1, 1);
connection master_1;
CREATE DATABASE auto_test_local;
USE auto_test_local;
CREATE TABLE tbl_a (
a INT,
b INT
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
SELECT a XOR b AS f FROM tbl_a;
f
0
1
1
0
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
!include ../my_2_1.cnf
--echo #
--echo # MDEV-29011 Server crash in spider_db_open_item_cond with XOR operator
--echo #
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
--connection child2_1
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
eval CREATE TABLE tbl_a (
a INT,
b INT
) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
INSERT INTO tbl_a VALUES (0, 0), (0, 1), (1, 0), (1, 1);
--connection master_1
CREATE DATABASE auto_test_local;
USE auto_test_local;
eval CREATE TABLE tbl_a (
a INT,
b INT
) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
SELECT a XOR b AS f FROM tbl_a;
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_query_log
--enable_result_log
......@@ -5002,16 +5002,6 @@ int spider_db_mbase_util::open_item_func(
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
break;
#ifdef MARIADB_BASE_VERSION
case Item_func::XOR_FUNC:
#else
case Item_func::COND_XOR_FUNC:
#endif
if (str)
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
DBUG_RETURN(
spider_db_open_item_cond((Item_cond *) item_func, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
case Item_func::TRIG_COND_FUNC:
DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
case Item_func::GUSERVAR_FUNC:
......@@ -5095,6 +5085,7 @@ int spider_db_mbase_util::open_item_func(
case Item_func::LE_FUNC:
case Item_func::GE_FUNC:
case Item_func::GT_FUNC:
case Item_func::XOR_FUNC:
if (str)
{
func_name = (char*) item_func->func_name();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment