mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
MDEV-29002 Spider: remove SPIDER_CONN::loop_check_meraged_last
The field is assigned but unused, and it causes heap-use-after-free.
This commit is contained in:
parent
761d5c8987
commit
7801c6d22d
4 changed files with 66 additions and 7 deletions
34
storage/spider/mysql-test/spider/bugfix/r/mdev_29002.result
Normal file
34
storage/spider/mysql-test/spider/bugfix/r/mdev_29002.result
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
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
|
32
storage/spider/mysql-test/spider/bugfix/t/mdev_29002.test
Normal file
32
storage/spider/mysql-test/spider/bugfix/t/mdev_29002.test
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
--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(
|
||||||
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
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue