From 53ecc354e398ead01b4dbf2d77170dafc29debd2 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 2 Jul 2020 23:50:56 +0300 Subject: Fixed errors found by MSAN --- libmysqld/libmysql.c | 1 + mysql-test/main/mysql_upgrade.test | 2 +- mysql-test/suite/csv/read_only.test | 1 + sql/sql_load.cc | 4 ++-- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c index 8c80e1a3f54..c4b3a17f508 100644 --- a/libmysqld/libmysql.c +++ b/libmysqld/libmysql.c @@ -1141,6 +1141,7 @@ my_bool STDCALL mysql_embedded(void) void my_net_local_init(NET *net) { net->max_packet= (uint) net_buffer_length; + net->read_timeout= net->write_timeout= 0; my_net_set_read_timeout(net, CLIENT_NET_READ_TIMEOUT); my_net_set_write_timeout(net, CLIENT_NET_WRITE_TIMEOUT); net->retry_count= 1; diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test index 0171fe6c7ba..a3d8ba0375c 100644 --- a/mysql-test/main/mysql_upgrade.test +++ b/mysql-test/main/mysql_upgrade.test @@ -17,7 +17,7 @@ let $MYSQLD_DATADIR= `select @@datadir`; file_exists $MYSQLD_DATADIR/mysql_upgrade_info; --echo Run it again - should say already completed ---replace_result $MYSQL_SERVER_VERSION VERSION +--replace_regex /upgraded to .*, use/upgraded to VERSION, use/ --exec $MYSQL_UPGRADE 2>&1 # It should have created a file in the MySQL Servers datadir diff --git a/mysql-test/suite/csv/read_only.test b/mysql-test/suite/csv/read_only.test index 2af209182d0..a3c851a6a70 100644 --- a/mysql-test/suite/csv/read_only.test +++ b/mysql-test/suite/csv/read_only.test @@ -1,3 +1,4 @@ +--source include/not_as_root.inc # # MDEV-11883 MariaDB crashes with out-of-memory when query information_schema # diff --git a/sql/sql_load.cc b/sql/sql_load.cc index d5692196457..09af120e6cf 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -2031,8 +2031,8 @@ int READ_INFO::read_xml(THD *thd) case '=': /* attribute name end - read the value */ //check for tag field and attribute name - if(!memcmp(tag.c_ptr_safe(), STRING_WITH_LEN("field")) && - !memcmp(attribute.c_ptr_safe(), STRING_WITH_LEN("name"))) + if(!strcmp(tag.c_ptr_safe(), "field") && + !strcmp(attribute.c_ptr_safe(), "name")) { /* this is format xx -- cgit v1.2.1 From 6e81ba0c12d1b94c0c046e1062f06e426036dbb2 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 3 Jul 2020 01:16:31 +0300 Subject: Don't give errors for default value copy in create_tmp_table --- mysql-test/main/type_temporal_innodb.result | 15 +++++++++++++++ mysql-test/main/type_temporal_innodb.test | 19 +++++++++++++++++++ sql/sql_select.cc | 7 +++++++ 3 files changed, 41 insertions(+) diff --git a/mysql-test/main/type_temporal_innodb.result b/mysql-test/main/type_temporal_innodb.result index b869822722d..c129f4810e2 100644 --- a/mysql-test/main/type_temporal_innodb.result +++ b/mysql-test/main/type_temporal_innodb.result @@ -160,3 +160,18 @@ SELECT * FROM t1 WHERE LEAST( UTC_TIME(), d ); d 2012-12-21 DROP TABLE t1; +# +# MDEV-17969 Assertion `name' failed in THD::push_warning_truncated_value_for_field +# +CREATE TABLE t1 (c1 DATE , c2 TIMESTAMP) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('2006-07-17','0000-00-00 00:00:00'); +CREATE TABLE t2 (pk INT, a1 TIME) Engine=InnoDB; +INSERT INTO t2 VALUES (6,'00:00:00'); +SET SESSION sql_mode= 'strict_all_tables,no_zero_date'; +CREATE TABLE tbl SELECT * FROM t1 WHERE t1.c1 = (SELECT c2 FROM t2 WHERE pk = 6); +ERROR 22007: Truncated incorrect datetime value: '0000-00-00 00:00:00' +DROP TABLE t1,t2; +SET sql_mode=DEFAULT; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/type_temporal_innodb.test b/mysql-test/main/type_temporal_innodb.test index 81f2f586c51..94f61d54634 100644 --- a/mysql-test/main/type_temporal_innodb.test +++ b/mysql-test/main/type_temporal_innodb.test @@ -66,3 +66,22 @@ CREATE TABLE t1 (d DATE) ENGINE=InnoDB; INSERT INTO t1 VALUES ('2012-12-21'); SELECT * FROM t1 WHERE LEAST( UTC_TIME(), d ); DROP TABLE t1; + +--echo # +--echo # MDEV-17969 Assertion `name' failed in THD::push_warning_truncated_value_for_field +--echo # + +CREATE TABLE t1 (c1 DATE , c2 TIMESTAMP) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('2006-07-17','0000-00-00 00:00:00'); +CREATE TABLE t2 (pk INT, a1 TIME) Engine=InnoDB; +INSERT INTO t2 VALUES (6,'00:00:00'); +SET SESSION sql_mode= 'strict_all_tables,no_zero_date'; +--error ER_TRUNCATED_WRONG_VALUE +CREATE TABLE tbl SELECT * FROM t1 WHERE t1.c1 = (SELECT c2 FROM t2 WHERE pk = 6); +# ^^^ there is no column c2 in table t2 +DROP TABLE t1,t2; +SET sql_mode=DEFAULT; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 88a1cdedeac..9f5a406507c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -17460,6 +17460,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields, bool using_unique_constraint= false; bool use_packed_rows= false; bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS); + bool save_abort_on_warning; char *tmpname,path[FN_REFLEN]; uchar *pos, *group_buff, *bitmaps; uchar *null_flags; @@ -17932,6 +17933,11 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields, } null_count= (blob_count == 0) ? 1 : 0; hidden_field_count=param->hidden_field_count; + + /* Protect against warnings in field_conv() in the next loop*/ + save_abort_on_warning= thd->abort_on_warning; + thd->abort_on_warning= 0; + for (i=0,reg_field=table->field; i < field_count; i++,reg_field++,recinfo++) { Field *field= *reg_field; @@ -18018,6 +18024,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields, bzero(pos, table->s->reclength - (pos - table->record[0])); MEM_CHECK_DEFINED(table->record[0], table->s->reclength); + thd->abort_on_warning= save_abort_on_warning; param->copy_field_end=copy; param->recinfo= recinfo; // Pointer to after last field store_record(table,s->default_values); // Make empty default record -- cgit v1.2.1 From 484931325e7bcecddc6daf1a55c008ddd67497e4 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 3 Jul 2020 18:37:33 +0300 Subject: Fix for MSAN from Marko related to buf_pool_resize --- storage/innobase/buf/buf0buf.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index e2425ccb6cc..c9cff9b3295 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1622,6 +1622,8 @@ buf_chunk_init( return(NULL); } + MEM_MAKE_ADDRESSABLE(chunk->mem, chunk->mem_size()); + #ifdef HAVE_LIBNUMA if (srv_numa_interleave) { struct bitmask *numa_mems_allowed = numa_get_mems_allowed(); @@ -2908,6 +2910,9 @@ withdraw_retry: while (chunk < echunk) { buf_block_t* block = chunk->blocks; + MEM_MAKE_ADDRESSABLE(chunk->mem, + chunk->mem_size()); + for (ulint j = chunk->size; j--; block++) { mutex_free(&block->mutex); -- cgit v1.2.1