From a7814d44fc50ecb270bf9816de7b019a71405e46 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 30 Jun 2016 12:59:52 +0400 Subject: [PATCH 1/4] MDEV-10311 - funcs_1.processlist_priv_no_prot fails sporadically State column of SHOW PROCESSLIST can have NULL values for being initialized threads (between new connection was acknowledged and waiting for network data). Fixed test case to handle such cases by waiting for State to become empty string. --- mysql-test/suite/funcs_1/datadict/processlist_priv.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc index b863b98d98a..38b9a3e309e 100644 --- a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc +++ b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc @@ -153,7 +153,7 @@ connection default; let $wait_timeout= 10; let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST -WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1'; +WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1' AND state=''; --source include/wait_condition.inc --replace_result ENGINE=MyISAM "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" "" eval SHOW CREATE TABLE $table; From e81455bb1617e574faab93f0846a6339064968b3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 4 May 2015 08:32:05 +0200 Subject: [PATCH 2/4] MDEV-7973 bigint fail with gcc 5.0 -LONGLONG_MIN is the undefined behavior in C. longlong2decimal() used to do this: int longlong2decimal(longlong from, decimal_t *to) { if ((to->sign= from < 0)) return ull2dec(-from, to); return ull2dec(from, to); and later in ull2dec() (DIG_BASE is 1000000000): static int ull2dec(ulonglong from, decimal_t *to) { for (intg1=1; from >= DIG_BASE; intg1++, from/=DIG_BASE) {} this breaks in gcc-5 at -O3. Here ull2dec is inlined into longlong2decimal. And gcc-5 believes that 'from' in the inlined ull2dec is always a positive integer (indeed, if it was negative, then -from was used instead). So gcc-5 uses *signed* comparison with DIG_BASE. Fix: make a special case for LONGLONG_MIN, don't negate it --- strings/decimal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/strings/decimal.c b/strings/decimal.c index 8dbe1bd57f4..b0c57d3db0c 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1025,7 +1025,11 @@ int ulonglong2decimal(ulonglong from, decimal_t *to) int longlong2decimal(longlong from, decimal_t *to) { if ((to->sign= from < 0)) + { + if (from == LONGLONG_MIN) // avoid undefined behavior + return ull2dec((ulonglong)LONGLONG_MIN, to); return ull2dec(-from, to); + } return ull2dec(from, to); } From 97ded96a33abb98190537e10e94c7dadf5bd0a5f Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 11 Jul 2016 17:03:03 +0000 Subject: [PATCH 3/4] MDEV-10318 : Fix crash in embedded, in case prepared statement has parameter placeholders, but does not bind parameters --- libmysqld/lib_sql.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 3d6ca5a3810..623569c18de 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -341,6 +341,12 @@ static int emb_stmt_execute(MYSQL_STMT *stmt) THD *thd; my_bool res; + if (stmt->param_count && !stmt->bind_param_done) + { + set_stmt_error(stmt, CR_PARAMS_NOT_BOUND, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + int4store(header, stmt->stmt_id); header[4]= (uchar) stmt->flags; thd= (THD*)stmt->mysql->thd; From 4e19aa386493fcf0613049b47cbb9b151e2d3e8d Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 12 Jul 2016 12:13:31 +0200 Subject: [PATCH 4/4] MDEV-10318 unset params in --ps --embedded add a test case --- mysql-test/r/ps_1general.result | 2 ++ mysql-test/t/ps_1general.test | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index 0a3d16cf48e..cc31944fd1f 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -788,3 +788,5 @@ execute stmt1; 1 drop prepare stmt1; drop table t1; +select ?+1; +Got one of the listed errors diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index 812b1b5ff94..7b7b87ef851 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -936,3 +936,10 @@ drop table t1; # Matthias # End of 4.1 tests + +# +# MDEV-10318 unset params in --ps --embedded +# +--error ER_PARSE_ERROR,2031 +select ?+1; +