List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:February 26 2010 11:42am
Subject:bzr commit into mysql-5.1-bugteam branch (joro:3358) Bug#51357
View as plain text  
#At file:///home/kgeorge/mysql/work/B51357-5.1-bugteam/ based on revid:gshchepa@stripped

 3358 Georgi Kodinov	2010-02-26
      Bug #51357: crash when using handler commands on spatial indexes
      
      Spatial indexes were not checking for out-of-record condition in
      the handler next command when the previous command didn't found
      rows.
      
      Fixed by making the rtree index to check for end of rows condition
      before re-using the key from the previous search.

    modified:
      mysql-test/r/gis-rtree.result
      mysql-test/t/gis-rtree.test
      storage/myisam/rt_index.c
=== modified file 'mysql-test/r/gis-rtree.result'
--- a/mysql-test/r/gis-rtree.result	2009-12-08 09:26:11 +0000
+++ b/mysql-test/r/gis-rtree.result	2010-02-26 11:42:35 +0000
@@ -1526,4 +1526,18 @@ SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT
 1
 1
 DROP TABLE t1;
+#
+# Bug #51357: crash when using handler commands on spatial indexes
+#
+CREATE TABLE t1(a GEOMETRY NOT NULL,SPATIAL INDEX a(a));
+HANDLER t1 OPEN;
+HANDLER t1 READ a FIRST;
+a
+HANDLER t1 READ a NEXT;
+a
+HANDLER t1 READ a PREV;
+a
+HANDLER t1 READ a LAST;
+a
+DROP TABLE t1;
 End of 5.0 tests.

=== modified file 'mysql-test/t/gis-rtree.test'
--- a/mysql-test/t/gis-rtree.test	2009-12-08 09:26:11 +0000
+++ b/mysql-test/t/gis-rtree.test	2010-02-26 11:42:35 +0000
@@ -902,4 +902,17 @@ SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT
 DROP TABLE t1;
 
 
+--echo #
+--echo # Bug #51357: crash when using handler commands on spatial indexes
+--echo #
+
+CREATE TABLE t1(a GEOMETRY NOT NULL,SPATIAL INDEX a(a));
+HANDLER t1 OPEN;
+HANDLER t1 READ a FIRST;
+HANDLER t1 READ a NEXT;
+HANDLER t1 READ a PREV;
+HANDLER t1 READ a LAST;
+
+DROP TABLE t1;
+
 --echo End of 5.0 tests.

=== modified file 'storage/myisam/rt_index.c'
--- a/storage/myisam/rt_index.c	2009-02-13 16:41:47 +0000
+++ b/storage/myisam/rt_index.c	2010-02-26 11:42:35 +0000
@@ -407,6 +407,12 @@ int rtree_get_next(MI_INFO *info, uint k
   my_off_t root;
   MI_KEYDEF *keyinfo = info->s->keyinfo + keynr;
 
+  if (info->s->state.key_root[keynr] == HA_OFFSET_ERROR)
+  {
+    my_errno= HA_ERR_END_OF_FILE;
+    return -1;
+  }
+  
   if (!info->buff_used)
   {
     uint k_len = keyinfo->keylength - info->s->base.rec_reflength;
@@ -430,12 +436,7 @@ int rtree_get_next(MI_INFO *info, uint k
   }
   else
   {
-    if ((root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
-    {
-      my_errno= HA_ERR_END_OF_FILE;
-      return -1;
-    }
-  
+    root = info->s->state.key_root[keynr];
     return rtree_get_req(info, keyinfo, key_length, root, 0);
   }
 }


Attachment: [text/bzr-bundle] bzr/joro@sun.com-20100226114235-7lsshb0qw2l5u8gb.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (joro:3358) Bug#51357Georgi Kodinov26 Feb