summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2019-11-25 16:03:45 +0300
committerAleksey Midenkov <midenok@gmail.com>2019-11-25 16:03:45 +0300
commita34c34d9a8d3159c5a0de281f4b0253a58ab2311 (patch)
tree4f0052d39e2c03fc3b72e899682f81024b1bd241
parent33f55789d354b0fccf5234027dc0bd66cbd0c539 (diff)
parent1d5f6a007339ce78471c125a9a5d5a73a5c664ff (diff)
downloadmariadb-git-a34c34d9a8d3159c5a0de281f4b0253a58ab2311.tar.gz
Merge 10.3 into 10.4
-rw-r--r--mysql-test/suite/federated/federatedx.result16
-rw-r--r--mysql-test/suite/federated/federatedx.test21
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_debug.result18
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_debug.test26
-rw-r--r--storage/federatedx/ha_federatedx.cc7
-rw-r--r--storage/innobase/row/row0log.cc4
6 files changed, 88 insertions, 4 deletions
diff --git a/mysql-test/suite/federated/federatedx.result b/mysql-test/suite/federated/federatedx.result
index 84dcb0d0a8c..8345f56dba9 100644
--- a/mysql-test/suite/federated/federatedx.result
+++ b/mysql-test/suite/federated/federatedx.result
@@ -2283,6 +2283,22 @@ connection default;
connection master;
CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:SLAVE_PORT/federated/t1';
ERROR HY000: Can't create federated table. Foreign data src error: database: 'federated' username: '' hostname: '127.0.0.1'
+#
+# MDEV-21049 Segfault in create federatedx table with empty hostname
+#
+connection master;
+CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
+CONNECTION='mysql://root@:SLAVE_PORT/federated/t1';
+ERROR HY000: Can't create federated table. Foreign data src error: database: 'federated' username: 'root' hostname: 'localhost'
+connection slave;
+CREATE TABLE federated.t1(x int);
+connection master;
+CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
+CONNECTION='mysql://root@:SLAVE_PORT/federated/t1';
+DROP TABLE federated.t1;
+connection slave;
+DROP TABLE federated.t1;
+connection default;
connection master;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/suite/federated/federatedx.test b/mysql-test/suite/federated/federatedx.test
index 29d1eaddc26..fcc0178c024 100644
--- a/mysql-test/suite/federated/federatedx.test
+++ b/mysql-test/suite/federated/federatedx.test
@@ -2010,4 +2010,25 @@ connection master;
--error ER_CANT_CREATE_FEDERATED_TABLE
eval CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:$SLAVE_MYPORT/federated/t1';
+--echo #
+--echo # MDEV-21049 Segfault in create federatedx table with empty hostname
+--echo #
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--error ER_CANT_CREATE_FEDERATED_TABLE
+eval CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
+ CONNECTION='mysql://root@:$SLAVE_MYPORT/federated/t1';
+
+connection slave;
+CREATE TABLE federated.t1(x int);
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
+ CONNECTION='mysql://root@:$SLAVE_MYPORT/federated/t1';
+
+DROP TABLE federated.t1;
+connection slave;
+DROP TABLE federated.t1;
+connection default;
+
source include/federated_cleanup.inc;
diff --git a/mysql-test/suite/innodb/r/instant_alter_debug.result b/mysql-test/suite/innodb/r/instant_alter_debug.result
index 7ab24a7671b..72c9a85e369 100644
--- a/mysql-test/suite/innodb/r/instant_alter_debug.result
+++ b/mysql-test/suite/innodb/r/instant_alter_debug.result
@@ -328,3 +328,21 @@ WHERE variable_name = 'innodb_instant_alter_column';
instants
22
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
+#
+# MDEV-21045 AddressSanitizer: use-after-poison in mem_heap_dup / row_log_table_get_pk_col
+#
+CREATE TABLE t1 (a TEXT) ENGINE = InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 (a) VALUES ('foo');
+ALTER TABLE t1 ADD COLUMN b INT DEFAULT 0,algorithm=instant;
+connect con2,localhost,root,,test;
+SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL onlinealter WAIT_FOR update';
+ALTER TABLE t1 ADD PRIMARY KEY (b);
+connection default;
+SET DEBUG_SYNC='now WAIT_FOR onlinealter';
+UPDATE t1 SET b = 1;
+SET DEBUG_SYNC='now SIGNAL update';
+connection con2;
+connection default;
+SET DEBUG_SYNC='RESET';
+disconnect con2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/instant_alter_debug.test b/mysql-test/suite/innodb/t/instant_alter_debug.test
index 267e2a2c22d..22452c78f4d 100644
--- a/mysql-test/suite/innodb/t/instant_alter_debug.test
+++ b/mysql-test/suite/innodb/t/instant_alter_debug.test
@@ -362,3 +362,29 @@ FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
+
+--echo #
+--echo # MDEV-21045 AddressSanitizer: use-after-poison in mem_heap_dup / row_log_table_get_pk_col
+--echo #
+CREATE TABLE t1 (a TEXT) ENGINE = InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 (a) VALUES ('foo');
+
+ALTER TABLE t1 ADD COLUMN b INT DEFAULT 0,algorithm=instant;
+
+--connect (con2,localhost,root,,test)
+SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL onlinealter WAIT_FOR update';
+--send
+ALTER TABLE t1 ADD PRIMARY KEY (b);
+
+--connection default
+SET DEBUG_SYNC='now WAIT_FOR onlinealter';
+UPDATE t1 SET b = 1;
+SET DEBUG_SYNC='now SIGNAL update';
+
+--connection con2
+--reap
+
+--connection default
+SET DEBUG_SYNC='RESET';
+--disconnect con2
+DROP TABLE t1;
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index bea7f2cfb87..49101447dda 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -807,12 +807,12 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share,
goto error;
if (share->hostname[0] == '\0')
- share->hostname= NULL;
+ share->hostname= strdup_root(mem_root, my_localhost);
}
if (!share->port)
{
- if (!share->hostname || strcmp(share->hostname, my_localhost) == 0)
+ if (0 == strcmp(share->hostname, my_localhost))
share->socket= (char *) MYSQL_UNIX_ADDR;
else
share->port= MYSQL_PORT;
@@ -3394,8 +3394,7 @@ int ha_federatedx::create(const char *name, TABLE *table_arg,
goto error;
/* loopback socket connections hang due to LOCK_open mutex */
- if ((!tmp_share.hostname || !strcmp(tmp_share.hostname,my_localhost)) &&
- !tmp_share.port)
+ if (0 == strcmp(tmp_share.hostname, my_localhost) && !tmp_share.port)
goto error;
/*
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index caffeab6af0..5b55409a13a 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -1166,6 +1166,10 @@ row_log_table_get_pk_col(
field = rec_get_nth_field(rec, offsets, i, &len);
+ if (len == UNIV_SQL_DEFAULT) {
+ field = log->instant_field_value(i, &len);
+ }
+
if (len == UNIV_SQL_NULL) {
if (!log->allow_not_null) {
return(DB_INVALID_NULL);