List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:June 15 2011 7:35am
Subject:bzr commit into mysql-5.1 branch (sergey.glukhov:3649) Bug#11766684
View as plain text  
#At file:///home/gluh/MySQL/mysql-5.1/ based on revid:sergey.glukhov@stripped

 3649 Sergey Glukhov	2011-06-15
      Bug#11766684 59851: UNINITIALISED VALUE IN ITEM_FUNC_LIKE::SELECT_OPTIMIZE WITH SUBQUERY AND
      Algorithm does not take into account the case when
      number of processed bits is 0. In this case this 
      fuction returns value with uninitialized string
      buffer. The fix is to return empty string when
      number of processed bits is 0.
     @ mysql-test/r/func_str.result
        test case
     @ mysql-test/t/func_str.test
        test case
     @ sql/item_strfunc.cc
        return empty string when number of processed bits is 0.

    modified:
      mysql-test/r/func_str.result
      mysql-test/t/func_str.test
      sql/item_strfunc.cc
=== modified file 'mysql-test/r/func_str.result'
--- a/mysql-test/r/func_str.result	2011-06-15 06:38:11 +0000
+++ b/mysql-test/r/func_str.result	2011-06-15 07:35:15 +0000
@@ -2634,4 +2634,15 @@ DROP TABLE t1;
 SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1)));
 SUBSTRING('1', DAY(FROM_UNIXTIME(-1)))
 NULL
+#
+# Bug#11766684 59851: UNINITIALISED VALUE IN ITEM_FUNC_LIKE::SELECT_OPTIMIZE WITH SUBQUERY AND
+#
+CREATE TABLE t2(a INT, KEY(a));
+INSERT INTO t2 VALUES (1),(2);
+CREATE TABLE t1(b INT, PRIMARY KEY(b));
+INSERT INTO t1 VALUES (0),(254);
+SELECT 1 FROM t2 WHERE a LIKE
+(SELECT  EXPORT_SET(1, b, b, b, b) FROM t1 LIMIT 1);
+1
+DROP TABLE t1, t2;
 End of 5.1 tests

=== modified file 'mysql-test/t/func_str.test'
--- a/mysql-test/t/func_str.test	2011-06-15 06:38:11 +0000
+++ b/mysql-test/t/func_str.test	2011-06-15 07:35:15 +0000
@@ -1386,4 +1386,16 @@ DROP TABLE t1;
 
 SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1)));
 
+--echo #
+--echo # Bug#11766684 59851: UNINITIALISED VALUE IN ITEM_FUNC_LIKE::SELECT_OPTIMIZE WITH SUBQUERY AND
+--echo #
+
+CREATE TABLE t2(a INT, KEY(a));
+INSERT INTO t2 VALUES (1),(2);
+CREATE TABLE t1(b INT, PRIMARY KEY(b));
+INSERT INTO t1 VALUES (0),(254);
+SELECT 1 FROM t2 WHERE a LIKE
+(SELECT  EXPORT_SET(1, b, b, b, b) FROM t1 LIMIT 1);
+DROP TABLE t1, t2;
+
 --echo End of 5.1 tests

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2011-06-15 06:38:11 +0000
+++ b/sql/item_strfunc.cc	2011-06-15 07:35:15 +0000
@@ -3104,6 +3104,12 @@ String* Item_func_export_set::val_str(St
   }
   null_value=0;
 
+  if (!num_set_values)
+  {
+    str_value.set("", 0, collation.collation);
+    return &str_value;
+  }
+
   for (uint i = 0; i < num_set_values; i++, mask = (mask << 1))
   {
     if (the_set & mask)


Attachment: [text/bzr-bundle] bzr/sergey.glukhov@oracle.com-20110615073515-1v9zzydg891trg3k.bundle
Thread
bzr commit into mysql-5.1 branch (sergey.glukhov:3649) Bug#11766684Sergey Glukhov15 Jun