MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:September 28 2009 3:04pm
Subject:bzr push into mysql-5.1-bugteam branch (joro:3140 to 3142)
View as plain text  
 3142 Georgi Kodinov	2009-09-28
      Fixed Sun Studio 8 compilation failures as suggested by Jorgen and reviewed
      by Svoj over e-mail.

    modified:
      storage/myisam/mi_check.c
 3141 Georgi Kodinov	2009-09-28 [merge]
      merge

    modified:
      mysql-test/r/subselect4.result
      mysql-test/t/subselect4.test
      sql/sql_select.cc
 3140 Magnus Blåudd	2009-09-28 [merge]
      Merge

    modified:
      mysys/my_thr_init.c
=== modified file 'mysql-test/r/subselect4.result'
--- a/mysql-test/r/subselect4.result	2009-09-03 15:03:46 +0000
+++ b/mysql-test/r/subselect4.result	2009-09-28 13:48:40 +0000
@@ -27,4 +27,35 @@ SELECT 1;
 1
 1
 DROP TABLE t1,t2,t3;
+#
+# Bug #47106: Crash / segfault on adding EXPLAIN to a non-crashing 
+# query
+#
+CREATE TABLE t1 (
+a INT,
+b INT,
+PRIMARY KEY (a),
+KEY b (b)
+);
+INSERT INTO t1 VALUES (1, 1), (2, 1);
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 SELECT * FROM t1;
+CREATE TABLE t3 LIKE t1;
+INSERT INTO t3 SELECT * FROM t1;
+# Should not crash.
+# Should have 1 impossible where and 2 dependent subqs.
+EXPLAIN
+SELECT
+(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
+FROM t3 WHERE 1 = 0 GROUP BY 1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
+2	DEPENDENT SUBQUERY	t1	index	NULL	PRIMARY	4	NULL	2	Using index
+2	DEPENDENT SUBQUERY	t2	index	b	b	5	NULL	2	Using where; Using index; Using join buffer
+# should return 0 rows
+SELECT
+(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
+FROM t3 WHERE 1 = 0 GROUP BY 1;
+(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
+DROP TABLE t1,t2,t3;
 End of 5.0 tests.

=== modified file 'mysql-test/t/subselect4.test'
--- a/mysql-test/t/subselect4.test	2009-09-03 15:03:46 +0000
+++ b/mysql-test/t/subselect4.test	2009-09-18 09:34:08 +0000
@@ -28,5 +28,37 @@ SELECT 1;
 
 DROP TABLE t1,t2,t3;
 
+--echo #
+--echo # Bug #47106: Crash / segfault on adding EXPLAIN to a non-crashing 
+--echo # query
+--echo #
+
+CREATE TABLE t1 (
+  a INT,
+  b INT,
+  PRIMARY KEY (a),
+  KEY b (b)
+);
+INSERT INTO t1 VALUES (1, 1), (2, 1);
+
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 SELECT * FROM t1;
+
+CREATE TABLE t3 LIKE t1;
+INSERT INTO t3 SELECT * FROM t1;
+
+--echo # Should not crash.
+--echo # Should have 1 impossible where and 2 dependent subqs.
+EXPLAIN
+SELECT
+  (SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
+FROM t3 WHERE 1 = 0 GROUP BY 1;
+
+--echo # should return 0 rows
+SELECT
+  (SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
+FROM t3 WHERE 1 = 0 GROUP BY 1;
+
+DROP TABLE t1,t2,t3;
 
 --echo End of 5.0 tests.

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2009-09-23 08:40:33 +0000
+++ b/sql/sql_select.cc	2009-09-28 13:48:40 +0000
@@ -3308,12 +3308,12 @@ add_key_equal_fields(KEY_FIELD **key_fie
      @retval FALSE  it's something else
 */
 
-inline static bool
+static bool
 is_local_field (Item *field)
 {
-  field= field->real_item();
-  return field->type() == Item::FIELD_ITEM && 
-    !((Item_field *)field)->depended_from;
+  return field->real_item()->type() == Item::FIELD_ITEM
+    && !(field->used_tables() & OUTER_REF_TABLE_BIT)
+    && !((Item_field *)field->real_item())->depended_from;
 }
 
 

=== modified file 'storage/myisam/mi_check.c'
--- a/storage/myisam/mi_check.c	2009-08-28 16:21:54 +0000
+++ b/storage/myisam/mi_check.c	2009-09-28 13:55:01 +0000
@@ -801,7 +801,7 @@ static int chk_index(MI_CHECK *param, MI
     {
       DBUG_DUMP("old",(uchar*) info->lastkey, info->lastkey_length);
       DBUG_DUMP("new",(uchar*) key, key_length);
-      DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos));
+      DBUG_DUMP("new_in_page",(uchar*) old_keypos,(uint) (keypos-old_keypos));
 
       if (comp_flag & SEARCH_FIND && flag == 0)
 	mi_check_print_error(param,"Found duplicated key at page %s",llstr(page,llbuff));
@@ -871,7 +871,7 @@ static int chk_index(MI_CHECK *param, MI
 			 llstr(page,llbuff),llstr(record,llbuff2),
 			 llstr(info->state->data_file_length,llbuff3)));
       DBUG_DUMP("key",(uchar*) key,key_length);
-      DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos));
+      DBUG_DUMP("new_in_page",(uchar*) old_keypos,(uint) (keypos-old_keypos));
       goto err;
     }
     param->record_checksum+=(ha_checksum) record;
@@ -1545,6 +1545,8 @@ int mi_repair(MI_CHECK *param, register 
   if (info->s->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))
     param->testflag|=T_CALC_CHECKSUM;
 
+  DBUG_ASSERT(param->use_buffers < SIZE_T_MAX);
+
   if (!param->using_global_keycache)
     VOID(init_key_cache(dflt_key_cache, param->key_cache_block_size,
                         (size_t) param->use_buffers, 0, 0));

Attachment: [text/bzr-bundle] bzr/joro@sun.com-20090928135501-ich8je5bxfzbu7u0.bundle
Thread
bzr push into mysql-5.1-bugteam branch (joro:3140 to 3142) Georgi Kodinov28 Sep