summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-02-17 08:05:00 +0400
committerAlexander Barkov <bar@mariadb.org>2016-02-17 08:05:00 +0400
commit09b586546029a7ffc6886b0ab528105ef3fb78eb (patch)
tree0aec0f4ee1bb481c99bd7381e64c899f52dd438b
parente8085d1b4147b43bbed22f2f7befd4f2b2fa178f (diff)
downloadmariadb-git-09b586546029a7ffc6886b0ab528105ef3fb78eb.tar.gz
MDEV-9511 Valgrind warnings 'Invalid read' in Field_newdate::cmp and Field_newdate::val_str
-rw-r--r--include/byte_order_generic_x86_64.h2
-rw-r--r--mysql-test/r/type_date.result9
-rw-r--r--mysql-test/t/type_date.test7
3 files changed, 17 insertions, 1 deletions
diff --git a/include/byte_order_generic_x86_64.h b/include/byte_order_generic_x86_64.h
index 877c1574dfa..b6b0c5d8ea5 100644
--- a/include/byte_order_generic_x86_64.h
+++ b/include/byte_order_generic_x86_64.h
@@ -31,7 +31,7 @@
Attention: Please, note, uint3korr reads 4 bytes (not 3)!
It means, that you have to provide enough allocated space.
*/
-#if defined(HAVE_purify) && !defined(_WIN32)
+#if defined(HAVE_valgrind) && !defined(_WIN32)
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16))
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 398f7b83bc9..66c9e7e48ef 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -438,3 +438,12 @@ id select_type table type possible_keys key key_len ref rows Extra
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
1
drop table t1;
+#
+# MDEV-9511 Valgrind warnings 'Invalid read' in Field_newdate::cmp and Field_newdate::val_str
+#
+CREATE TABLE t1 (f1 DATE, f2 VARCHAR(1));
+INSERT INTO t1 VALUES ('2003-04-27','a'),('1900-01-01','a');
+SELECT GROUP_CONCAT(f2, IF(f1, f2, f1), f1 ORDER BY 2,1,3) FROM t1;
+GROUP_CONCAT(f2, IF(f1, f2, f1), f1 ORDER BY 2,1,3)
+aa1900-01-01,aa2003-04-27
+DROP TABLE t1;
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index 6b8ed128f4b..c01adc1b233 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -385,3 +385,10 @@ select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
drop table t1;
+--echo #
+--echo # MDEV-9511 Valgrind warnings 'Invalid read' in Field_newdate::cmp and Field_newdate::val_str
+--echo #
+CREATE TABLE t1 (f1 DATE, f2 VARCHAR(1));
+INSERT INTO t1 VALUES ('2003-04-27','a'),('1900-01-01','a');
+SELECT GROUP_CONCAT(f2, IF(f1, f2, f1), f1 ORDER BY 2,1,3) FROM t1;
+DROP TABLE t1;