[Commits] a20e1ce85ec: MDEV-13232: Assertion `(&(&share->intern_lock)->m_mutex)->count > 0 && pthread_equal(pthread_self(), (&(&share->intern_lock)->m_mutex)->thread)' failed in _ma_state_info_write

Oleksandr Byelkin sanja at mariadb.com
Mon Apr 23 11:35:33 EEST 2018


revision-id: a20e1ce85ec56616fa048e9ba39c25c65b098fce (mariadb-10.3.6-36-ga20e1ce85ec)
parent(s): c6ba758d1d41c11466b8f9b61b4546efc95aa689
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-04-23 10:35:33 +0200
message:

MDEV-13232: Assertion `(&(&share->intern_lock)->m_mutex)->count > 0 && pthread_equal(pthread_self(), (&(&share->intern_lock)->m_mutex)->thread)' failed in _ma_state_info_write

Limit length of result of "negative" operation to something reasonable

---
 mysql-test/main/union.result | 14 ++++++++++++++
 mysql-test/main/union.test   | 15 +++++++++++++++
 sql/item_func.cc             |  3 +++
 3 files changed, 32 insertions(+)

diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result
index 4e5f9312e03..39cd68ae851 100644
--- a/mysql-test/main/union.result
+++ b/mysql-test/main/union.result
@@ -2500,5 +2500,19 @@ t2	CREATE TABLE `t2` (
 DROP TABLE t2;
 DROP TABLE t1;
 #
+# MDEV-13232: Assertion `(&(&share->intern_lock)->m_mutex)->count > 0 &&
+# pthread_equal(pthread_self(), (&(&share->intern_lock)->m_mutex)->
+# thread)' failed in _ma_state_info_write
+#
+CREATE TABLE t1 (c1 CHAR(8));
+INSERT INTO t1 VALUES ('10'),('-10');
+CREATE TABLE t2 (c2 CHAR);
+SET @a= CAST('10' AS CHAR);
+SELECT c1 FROM t1 UNION SELECT - @a FROM t2;
+c1
+10
+-10
+drop table t1,t2;
+#
 # End of 10.3 tests
 #
diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test
index f86cae87524..b9b38271f83 100644
--- a/mysql-test/main/union.test
+++ b/mysql-test/main/union.test
@@ -1745,6 +1745,21 @@ SHOW CREATE TABLE t2;
 DROP TABLE t2;
 DROP TABLE t1;
 
+--echo #
+--echo # MDEV-13232: Assertion `(&(&share->intern_lock)->m_mutex)->count > 0 &&
+--echo # pthread_equal(pthread_self(), (&(&share->intern_lock)->m_mutex)->
+--echo # thread)' failed in _ma_state_info_write
+--echo #
+
+CREATE TABLE t1 (c1 CHAR(8));
+INSERT INTO t1 VALUES ('10'),('-10');
+ 
+CREATE TABLE t2 (c2 CHAR);
+SET @a= CAST('10' AS CHAR);
+ 
+SELECT c1 FROM t1 UNION SELECT - @a FROM t2;
+
+drop table t1,t2;
 
 --echo #
 --echo # End of 10.3 tests
diff --git a/sql/item_func.cc b/sql/item_func.cc
index e2740272385..ae6c61e83f4 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1935,6 +1935,9 @@ void Item_func_neg::fix_length_and_dec_double()
   set_handler(&type_handler_double);
   decimals= args[0]->decimals; // Preserve NOT_FIXED_DEC
   max_length= args[0]->max_length + 1;
+  // Limit length with something reasonable
+  uint32 mlen= type_handler()->max_display_length(this);
+  set_if_smaller(max_length, mlen);
   unsigned_flag= false;
 }
 


More information about the commits mailing list