List:Commits« Previous MessageNext Message »
From:Ramil Kalimullin Date:June 8 2011 5:36pm
Subject:bzr push into mysql-trunk branch (ramil:3167 to 3168) Bug#11755628
Bug#11759650
View as plain text  
 3168 Ramil Kalimullin	2011-06-08
      BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD 
      BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL
      
      Problem: performing spatial operation on "wrong"
      polygons may lead to server crash.
      
      Fix: take into account some corner cases:
      polygons with 0-point linerings,
      polygons with touching linerings.
     @ mysql-test/r/gis-precise.result
        BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD 
        BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL
          - test result.
     @ mysql-test/t/gis-precise.test
        BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD 
        BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL
          - test case.
     @ sql/gcalc_tools.cc
        BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD 
        BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL
          - calculating a shape of the resulting spatial object fixed 
        to handle polygons with touching linerings.
     @ sql/spatial.cc
        BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD 
        BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL
          - check if there're points in each poligon's line ring to avoid
        OOM error.

    modified:
      mysql-test/r/gis-precise.result
      mysql-test/t/gis-precise.test
      sql/gcalc_tools.cc
      sql/spatial.cc
 3167 Dmitry Shulga	2011-06-08 [merge]
      Auto-merge of patch for bug#11763757.

    modified:
      mysql-test/r/sp_notembedded.result
      mysql-test/t/sp_notembedded.test
=== modified file 'mysql-test/r/gis-precise.result'
--- a/mysql-test/r/gis-precise.result	2011-01-14 21:08:28 +0000
+++ b/mysql-test/r/gis-precise.result	2011-06-08 17:24:16 +0000
@@ -201,3 +201,28 @@ result
 SELECT ST_Equals(PointFromText('POINT (12 13)'),PointFromText('POINT (12 13)')) as result;
 result
 1
+#
+# BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD 
+# BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL 
+#
+SELECT ASTEXT(ST_UNION(GEOMFROMTEXT('POLYGON((525000 183300,525400
+183300,525400 18370, 525000 183700,525000 183300))'),
+geomfromtext('POLYGON((525298.67 183511.53,525296.57
+183510.39,525296.42 183510.31,525289.11 183506.62,525283.17
+183503.47,525280.98 183502.26,525278.63 183500.97,525278.39
+183500.84,525276.79 183500,525260.7 183491.55,525263.95
+183484.75,525265.58 183481.95,525278.97 183488.73,525276.5
+183493.45,525275.5 183495.7,525280.35 183498.2,525282.3
+183499.1,525282.2 183499.3,525283.55 183500,525301.75
+183509.35,525304.45 183504.25,525307.85 183504.95,525304.5
+183510.83,525302.81 183513.8,525298.67 183511.53),(525275.06
+183489.89,525272.06 183488.37,525268.94 183494.51,525271.94
+183496.03,525275.06 183489.89),(525263.26 183491.55,525266.15
+183493.04,525269.88 183485.82,525266.99 183484.33,525263.26
+183491.55))'))) st_u;
+st_u
+MULTIPOLYGON(((525400 18370,525000.9677614468 183300,525400 183300,525400 18370)),((525000.9677614468 183300,525000 183300,525000 183700,525000.9677614468 183300)),((525265.58 183481.95,525263.95 183484.75,525260.7 183491.55,525276.79 183500,525278.39 183500.84,525278.63 183500.97,525280.98 183502.26,525283.17 183503.47,525289.11 183506.62,525296.42 183510.31,525296.57 183510.39,525298.67 183511.53,525302.81 183513.8,525304.5 183510.83,525307.85 183504.95,525304.45 183504.25,525301.75 183509.35,525283.55 183500,525282.2 183499.3,525282.3 183499.1,525280.35 183498.2,525275.5 183495.7,525276.5 183493.45,525278.97 183488.73,525265.58 183481.95),(525266.99 183484.33,525263.26 183491.55,525266.15 183493.04,525269.88 183485.82,525266.99 183484.33),(525272.06 183488.37,525268.94 183494.51,525271.94 183496.03,525275.06 183489.89,525272.06 183488.37)))
+SET @a=0x0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000000000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F;
+SELECT ASTEXT(TOUCHES(@a, GEOMFROMTEXT('point(0 0)'))) t;
+t
+NULL

=== modified file 'mysql-test/t/gis-precise.test'
--- a/mysql-test/t/gis-precise.test	2011-01-14 21:08:28 +0000
+++ b/mysql-test/t/gis-precise.test	2011-06-08 17:24:16 +0000
@@ -108,3 +108,28 @@ select st_touches(geomfromtext('polygon(
 SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),PolyFromText('POLYGON((67 13, 67 18, 59 19, 59 13, 59 13, 67 13) )')) as result;
 SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),PolyFromText('POLYGON((67 13, 67 18, 59 18, 59 13, 59 13, 67 13) )')) as result;
 SELECT ST_Equals(PointFromText('POINT (12 13)'),PointFromText('POINT (12 13)')) as result;
+
+
+--echo #
+--echo # BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD 
+--echo # BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL 
+--echo #
+
+SELECT ASTEXT(ST_UNION(GEOMFROMTEXT('POLYGON((525000 183300,525400
+183300,525400 18370, 525000 183700,525000 183300))'),
+geomfromtext('POLYGON((525298.67 183511.53,525296.57
+183510.39,525296.42 183510.31,525289.11 183506.62,525283.17
+183503.47,525280.98 183502.26,525278.63 183500.97,525278.39
+183500.84,525276.79 183500,525260.7 183491.55,525263.95
+183484.75,525265.58 183481.95,525278.97 183488.73,525276.5
+183493.45,525275.5 183495.7,525280.35 183498.2,525282.3
+183499.1,525282.2 183499.3,525283.55 183500,525301.75
+183509.35,525304.45 183504.25,525307.85 183504.95,525304.5
+183510.83,525302.81 183513.8,525298.67 183511.53),(525275.06
+183489.89,525272.06 183488.37,525268.94 183494.51,525271.94
+183496.03,525275.06 183489.89),(525263.26 183491.55,525266.15
+183493.04,525269.88 183485.82,525266.99 183484.33,525263.26
+183491.55))'))) st_u;
+
+SET @a=0x0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000000000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F;
+SELECT ASTEXT(TOUCHES(@a, GEOMFROMTEXT('point(0 0)'))) t;

=== modified file 'sql/gcalc_tools.cc'
--- a/sql/gcalc_tools.cc	2010-10-14 05:26:25 +0000
+++ b/sql/gcalc_tools.cc	2011-06-08 17:24:16 +0000
@@ -584,8 +584,7 @@ int Gcalc_operation_reducer::start_coupl
   t1->rp= rp1;
   if (prev_range)
   {
-    rp0->outer_poly= prev_range->thread_start;
-    t1->thread_start= rp1;
+    rp0->outer_poly= t1->thread_start= prev_range->thread_start;
   }
   else
   {
@@ -617,8 +616,7 @@ int Gcalc_operation_reducer::start_i_cou
   t1->rp= rp1;
   if (prev_range)
   {
-    rp0->outer_poly= prev_range->thread_start;
-    t1->thread_start= rp1;
+    rp0->outer_poly= t1->thread_start= prev_range->thread_start;
   }
   else
   {

=== modified file 'sql/spatial.cc'
--- a/sql/spatial.cc	2011-05-10 13:37:37 +0000
+++ b/sql/spatial.cc	2011-06-08 17:24:16 +0000
@@ -1141,7 +1141,7 @@ int Gis_polygon::store_shapes(Gcalc_shap
       return 1;
     n_points= uint4korr(data);
     data+= 4;
-    if (no_data(data, POINT_DATA_SIZE * n_points))
+    if (!n_points || no_data(data, POINT_DATA_SIZE * n_points))
       return 1;
 
     trn->start_ring();

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (ramil:3167 to 3168) Bug#11755628Bug#11759650Ramil Kalimullin9 Jun