Commit 7801c6d2 authored by Yuchen Pei's avatar Yuchen Pei

MDEV-29002 Spider: remove SPIDER_CONN::loop_check_meraged_last

The field is assigned but unused, and it causes heap-use-after-free.
parent 761d5c89
for master_1
for child2
for child3
SET spider_same_server_link= on;
CREATE SERVER s FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t (a INT);
CREATE TABLE t1_spider (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't'";
CREATE TABLE t2_spider (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't'";
SELECT * FROM t1_spider, t2_spider;
a a
SELECT table_name, index_name, cardinality FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name IN ('t1_spider','t2_spider');
table_name index_name cardinality
RENAME TABLE t1_spider TO t3_spider;
SELECT * FROM t3_spider;
a
DROP TABLE t3_spider, t2_spider, t;
drop server s;
CREATE TABLE t1 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",HOST "srv",TABLE "t"';
CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",HOST "srv",TABLE "t"';
CREATE TABLE t3 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",HOST "srv",TABLE "t"';
SHOW TABLE STATUS;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
t1 SPIDER 10 NULL 0 0 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL Unable to connect to foreign data source: srv 0
t2 SPIDER 10 NULL 0 0 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL Unable to connect to foreign data source: srv 0
t3 SPIDER 10 NULL 0 0 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL Unable to connect to foreign data source: srv 0
Warnings:
Warning 1429 Unable to connect to foreign data source: srv
Warning 1429 Unable to connect to foreign data source: srv
Warning 1429 Unable to connect to foreign data source: srv
drop table t1, t2, t3;
for master_1
for child2
for child3
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
SET spider_same_server_link= on;
evalp CREATE SERVER s FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t (a INT);
CREATE TABLE t1_spider (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't'";
CREATE TABLE t2_spider (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't'";
SELECT * FROM t1_spider, t2_spider;
SELECT table_name, index_name, cardinality FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name IN ('t1_spider','t2_spider');
RENAME TABLE t1_spider TO t3_spider;
SELECT * FROM t3_spider;
DROP TABLE t3_spider, t2_spider, t;
drop server s;
# case by roel
CREATE TABLE t1 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",HOST "srv",TABLE "t"';
CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",HOST "srv",TABLE "t"';
CREATE TABLE t3 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",HOST "srv",TABLE "t"';
SHOW TABLE STATUS;
drop table t1, t2, t3;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log
...@@ -1783,13 +1783,7 @@ int spider_conn_queue_and_merge_loop_check( ...@@ -1783,13 +1783,7 @@ int spider_conn_queue_and_merge_loop_check(
lcptr->flag = SPIDER_LOP_CHK_MERAGED; lcptr->flag = SPIDER_LOP_CHK_MERAGED;
lcptr->next = NULL; lcptr->next = NULL;
if (!conn->loop_check_meraged_first) if (!conn->loop_check_meraged_first)
{
conn->loop_check_meraged_first = lcptr; conn->loop_check_meraged_first = lcptr;
conn->loop_check_meraged_last = lcptr;
} else {
conn->loop_check_meraged_last->next = lcptr;
conn->loop_check_meraged_last = lcptr;
}
} }
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -940,7 +940,6 @@ typedef struct st_spider_conn ...@@ -940,7 +940,6 @@ typedef struct st_spider_conn
SPIDER_CONN_LOOP_CHECK *loop_check_ignored_first; SPIDER_CONN_LOOP_CHECK *loop_check_ignored_first;
SPIDER_CONN_LOOP_CHECK *loop_check_ignored_last; SPIDER_CONN_LOOP_CHECK *loop_check_ignored_last;
SPIDER_CONN_LOOP_CHECK *loop_check_meraged_first; SPIDER_CONN_LOOP_CHECK *loop_check_meraged_first;
SPIDER_CONN_LOOP_CHECK *loop_check_meraged_last;
} SPIDER_CONN; } SPIDER_CONN;
typedef struct st_spider_lgtm_tblhnd_share typedef struct st_spider_lgtm_tblhnd_share
......
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