summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2013-08-08 11:36:03 +0400
committerAlexander Barkov <bar@mariadb.org>2013-08-08 11:36:03 +0400
commite6a6f653a9c67741f67df9448b3182066939283c (patch)
tree5f307b4631fc35ddb9326caefbddc02c3a9b10c6
parent8de120e2b947f8dc006fbbc0ff9326e2bd967fc2 (diff)
downloadmariadb-git-e6a6f653a9c67741f67df9448b3182066939283c.tar.gz
MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types
Fixing a typo: bit AND (&) was erroneously used instead of logical AND (&&)
-rw-r--r--mysql-test/r/func_set.result19
-rw-r--r--mysql-test/t/func_set.test18
-rw-r--r--sql/item_cmpfunc.cc2
3 files changed, 38 insertions, 1 deletions
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index 14ebc8203ec..4c7ec14490f 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -159,3 +159,22 @@ SELECT CONVERT( a USING latin1 ) FROM t2;
CONVERT( a USING latin1 )
DROP TABLE t1, t2;
+#
+# Start of 5.3 tests
+#
+#
+# MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types
+#
+CREATE TABLE t1 (pk INT PRIMARY KEY);
+INSERT INTO t1 VALUES (10),(11);
+SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
+INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 )
+8
+8
+Warnings:
+Warning 1292 Incorrect datetime value: '10'
+Warning 1292 Incorrect datetime value: '11'
+DROP TABLE t1;
+#
+# End of 5.3 tests
+#
diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test
index 294efa8caf1..1dab3aae852 100644
--- a/mysql-test/t/func_set.test
+++ b/mysql-test/t/func_set.test
@@ -97,3 +97,21 @@ SELECT CONVERT( a USING latin1 ) FROM t1;
SELECT CONVERT( a USING latin1 ) FROM t2;
DROP TABLE t1, t2;
+
+
+--echo #
+--echo # Start of 5.3 tests
+--echo #
+
+--echo #
+--echo # MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types
+--echo #
+CREATE TABLE t1 (pk INT PRIMARY KEY);
+INSERT INTO t1 VALUES (10),(11);
+SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 5.3 tests
+--echo #
+
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index b2a91c8ec1e..2ebeb821321 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1960,7 +1960,7 @@ void Item_func_interval::fix_length_and_dec()
for (uint i= 1; not_null_consts && i < rows; i++)
{
Item *el= row->element_index(i);
- not_null_consts&= el->const_item() & !el->is_null();
+ not_null_consts&= el->const_item() && !el->is_null();
}
if (not_null_consts &&