Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

bk commit into 4.1 tree (holyfoot:1.2679) BUG#30286

From: <holyfoot(at)mysql.com>
Date: Fri Aug 17 2007 - 06:29:48 EDT


Below is the list of changes that have just been committed into a local 4.1 repository of hf. When hf does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository.
For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@1.2679, 2007-08-17 15:29:47+05:00, holyfoot@mysql.com +3 -0   Bug #30286 spatial index cause corruption and server crash!   

  Sometimes the result of the DOUBLE claculations can be bigger   than DBL_MAX constant we use in code. If that happens in   rtree_pick_key it can fail as it cannot find suitable key.   

  So we shouldn't use DBL_MAX constant as a biggest double we   can ever get.

  myisam/rt_index.c@1.21, 2007-08-17 15:22:21+05:00, holyfoot@mysql.com +4 -13     Bug #30286 spatial index cause corruption and server crash!     

    always set the best_key with the first key we get, so we always return     somthing valid.

  mysql-test/r/gis-rtree.result@1.16, 2007-08-17 15:25:55+05:00, holyfoot@mysql.com +31 -0     Bug #30286 spatial index cause corruption and server crash!     test result

  mysql-test/t/gis-rtree.test@1.16, 2007-08-17 15:24:54+05:00, holyfoot@mysql.com +36 -0     Bug #30286 spatial index cause corruption and server crash!     test case

diff -Nrup a/myisam/rt_index.c b/myisam/rt_index.c
--- a/myisam/rt_index.c	2007-03-09 19:19:40 +04:00
+++ b/myisam/rt_index.c	2007-08-17 15:22:21 +05:00

@@ -485,10 +485,10 @@ static uchar *rtree_pick_key(MI_INFO *in
uint key_length, uchar *page_buf, uint nod_flag)
 {
   double increase;
- double best_incr = DBL_MAX;
+ double best_incr;
Do you need help?X

   double area;

   double best_area;
-  uchar *best_key;
+  uchar *best_key= NULL;

   uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);    uchar *last = rt_PAGE_END(page_buf);  

@@ -502,21 +502,12 @@ static uchar *rtree_pick_key(MI_INFO *in

                                         &area)) == -1.0)
       return NULL;
     /* The following should be safe, even if we compare doubles */
- if (increase < best_incr)
+ if (!best_key || increase < best_incr ||
+        ((increase == best_incr) && (area < best_area)))
     {
       best_key = k;
       best_area = area;
       best_incr = increase;
-    }
-    else
-    {
-      /* The following should be safe, even if we compare doubles */
-      if ((increase == best_incr) && (area < best_area))
-      {
-        best_key = k;
-        best_area = area;
-        best_incr = increase;
-      }
     }

   }
   return best_key;
diff -Nrup a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
--- a/mysql-test/r/gis-rtree.result	2007-03-08 12:54:35 +04:00
+++ b/mysql-test/r/gis-rtree.result	2007-08-17 15:25:55 +05:00

@@ -1420,3 +1420,34 @@ CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text test.t1 check status OK

 DROP TABLE t1;
+create table t1 (a geometry not null, spatial index(a));
+insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
+insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
+insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
+insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
+insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
+insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
+insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
+insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
+insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
Do you need more help?X
+insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260))); +insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236))); +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125))); +insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275))); +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29))); +insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86))); +insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270))); +insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19))); +insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255))); +insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130))); +insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39))); +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159))); +insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270))); +insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82))); +insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34))); +insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53))); +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183))); +insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192))); +insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159))); +insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
Can we help you?X
+drop table t1; diff -Nrup a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test --- a/mysql-test/t/gis-rtree.test 2007-03-08 12:54:35 +04:00 +++ b/mysql-test/t/gis-rtree.test 2007-08-17 15:24:54 +05:00

@@ -798,4 +798,40 @@ UPDATE t1 set spatial_point=GeomFromText
 CHECK TABLE t1 EXTENDED;
 DROP TABLE t1;  
+#
+# Bug #30286 spatial index cause corruption and server crash!
+#
+
+create table t1 (a geometry not null, spatial index(a));
+insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
+insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
+insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
+insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
+insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
+insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
+insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
+insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
+insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
+insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
+insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
+insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
+insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
+insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
+insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
+insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
Can't find what you're looking for?X
+insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19))); +insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255))); +insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130))); +insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39))); +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159))); +insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270))); +insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82))); +insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34))); +insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53))); +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183))); +insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192))); +insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159))); +insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178))); +drop table t1; +

 # End of 4.1 tests
-- 
MySQL Code Commits Mailing List
For list archives: 
http://lists.mysql.com/commits
To unsubscribe:    
http://lists.mysql.com/commits?unsub=lists@pantek.com
Received on Fri Aug 17 07:33:21 2007

This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 08:37:33 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library