#At file:///home/gluh/MySQL/mysql-5.1/ based on revid:sven.sandberg@stripped
3654 Sergey Glukhov 2011-04-12
Bug#11766212 59270: NOT IN (YEAR( ... ), ... ) PRODUCES MANY VALGRIND WARNINGS
Valgrind warning happens due to early null values check
in Item_func_in::fix_length_and_dec(before item evaluation).
As result null value items with uninitialized values are
placed into array and it leads to valgrind warnings during
value array sorting.
The fix is to check null value after item evaluation, item
is evaluated in in_array::set() method.
@ mysql-test/r/func_in.result
test case
@ mysql-test/t/func_in.test
test case
@ sql/item_cmpfunc.cc
The fix is to check null value after item evaluation.
modified:
mysql-test/r/func_in.result
mysql-test/t/func_in.test
sql/item_cmpfunc.cc
=== modified file 'mysql-test/r/func_in.result'
--- a/mysql-test/r/func_in.result 2010-06-22 18:53:08 +0000
+++ b/mysql-test/r/func_in.result 2011-04-12 09:51:36 +0000
@@ -770,4 +770,10 @@ CASE a WHEN a THEN a END
NULL
DROP TABLE t1;
#
+# Bug #11766212 59270: NOT IN (YEAR( ... ), ... ) PRODUCES MANY VALGRIND WARNINGS
+#
+SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1);
+1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1)
+1
+#
End of 5.1 tests
=== modified file 'mysql-test/t/func_in.test'
--- a/mysql-test/t/func_in.test 2010-06-22 18:53:08 +0000
+++ b/mysql-test/t/func_in.test 2011-04-12 09:51:36 +0000
@@ -555,5 +555,11 @@ SELECT CASE a WHEN a THEN a END FROM t1
DROP TABLE t1;
--echo #
+--echo # Bug #11766212 59270: NOT IN (YEAR( ... ), ... ) PRODUCES MANY VALGRIND WARNINGS
+--echo #
+
+SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1);
+
+--echo #
--echo End of 5.1 tests
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc 2011-03-03 20:11:47 +0000
+++ b/sql/item_cmpfunc.cc 2011-04-12 09:51:36 +0000
@@ -4000,13 +4000,11 @@ void Item_func_in::fix_length_and_dec()
uint j=0;
for (uint i=1 ; i < arg_count ; i++)
{
- if (!args[i]->null_value) // Skip NULL values
- {
- array->set(j,args[i]);
- j++;
- }
- else
- have_null= 1;
+ array->set(j,args[i]);
+ if (!args[i]->null_value) // Skip NULL values
+ j++;
+ else
+ have_null= 1;
}
if ((array->used_count= j))
array->sort();
Attachment: [text/bzr-bundle] bzr/sergey.glukhov@oracle.com-20110412095136-uirtqyq7pu1q16td.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (sergey.glukhov:3654) Bug#11766212 | Sergey Glukhov | 12 Apr |