summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2009-04-23 12:50:34 +0500
committerSergey Glukhov <Sergey.Glukhov@sun.com>2009-04-23 12:50:34 +0500
commit40e0bcab4c970abfa4b88dbfc52f1688fe0a8900 (patch)
tree8f5964fd4505e301aed871271b32cd0c0f27954c
parent9bd3ef2ebb58549f7d96dd42bbc0bbebd26ed967 (diff)
downloadmariadb-git-40e0bcab4c970abfa4b88dbfc52f1688fe0a8900.tar.gz
Bug#44367 valgrind warnings with find_in_set() functions
init 'wc' variable mysql-test/r/func_set.result: test result mysql-test/t/func_set.test: test case sql/item_func.cc: init 'wc' variable
-rw-r--r--mysql-test/r/func_set.result43
-rw-r--r--mysql-test/t/func_set.test12
-rw-r--r--sql/item_func.cc2
3 files changed, 56 insertions, 1 deletions
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index 3f9f7b85731..ecdc35ac4cd 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -103,3 +103,46 @@ CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL))
8
End of 5.0 tests
+drop table if exists t1;
+create table t1 (f1 set('test1','test2','test3') character set utf8 default null)
+engine=myisam default charset=latin1;
+insert into t1 values (''),(null),(null),(''),(''),('');
+select find_in_set(f1,f1) as a from t1,(select find_in_set(f1,f1) as b from t1) a;
+a
+0
+NULL
+NULL
+0
+0
+0
+0
+NULL
+NULL
+0
+0
+0
+0
+NULL
+NULL
+0
+0
+0
+0
+NULL
+NULL
+0
+0
+0
+0
+NULL
+NULL
+0
+0
+0
+0
+NULL
+NULL
+0
+0
+0
+drop table t1;
diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test
index e4fde6e0e0e..5f37cd2a13e 100644
--- a/mysql-test/t/func_set.test
+++ b/mysql-test/t/func_set.test
@@ -72,3 +72,15 @@ SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL));
--echo End of 5.0 tests
+
+#
+# Bug#44367 valgrind warnings with find_in_set() functions
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (f1 set('test1','test2','test3') character set utf8 default null)
+engine=myisam default charset=latin1;
+insert into t1 values (''),(null),(null),(''),(''),('');
+select find_in_set(f1,f1) as a from t1,(select find_in_set(f1,f1) as b from t1) a;
+drop table t1;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 8fc9fadb6bd..876aee719a3 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2716,7 +2716,7 @@ longlong Item_func_find_in_set::val_int()
int diff;
if ((diff=buffer->length() - find->length()) >= 0)
{
- my_wc_t wc;
+ my_wc_t wc= 0;
CHARSET_INFO *cs= cmp_collation.collation;
const char *str_begin= buffer->ptr();
const char *str_end= buffer->ptr();