[Commits] Rev 4428: MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int). in file:///home/hf/wmar/mdev-7516/

holyfoot at askmonty.org holyfoot at askmonty.org
Tue Feb 10 15:35:25 EET 2015


At file:///home/hf/wmar/mdev-7516/

------------------------------------------------------------
revno: 4428
revision-id: holyfoot at askmonty.org-20150210121631-byrqdvs0ctrrnsf6
parent: jplindst at mariadb.org-20150210121723-1gxyej083cf1nv8h
committer: Alexey Botchkov <holyfoot at askmonty.org>
branch nick: mdev-7516
timestamp: Tue 2015-02-10 16:16:31 +0400
message:
  MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int).
      When the distance in ST_BUFFER is too far negative the coordinates can run out of the operational
      area. We should just return an empty geometry in this case.
-------------- next part --------------
=== modified file 'mysql-test/r/gis.result'
--- a/mysql-test/r/gis.result	2014-11-18 16:36:51 +0000
+++ b/mysql-test/r/gis.result	2015-02-10 12:16:31 +0000
@@ -1607,4 +1607,7 @@ create table t1 (pt point);
 insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
 ERROR 22007: Incorrect POINT value: 'POLYGON' for column 'pt' at row 1
 drop table t1;
+SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
+st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100))
+GEOMETRYCOLLECTION EMPTY
 End of 5.5 tests

=== modified file 'mysql-test/t/gis.test'
--- a/mysql-test/t/gis.test	2014-11-18 16:36:51 +0000
+++ b/mysql-test/t/gis.test	2015-02-10 12:16:31 +0000
@@ -1465,4 +1465,9 @@ create table t1 (pt point);
 insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
 drop table t1;
 
+#
+# MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int)
+#
+SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
+
 --echo End of 5.5 tests

=== modified file 'sql/item_geofunc.cc'
--- a/sql/item_geofunc.cc	2014-02-22 21:51:20 +0000
+++ b/sql/item_geofunc.cc	2015-02-10 12:16:31 +0000
@@ -1286,6 +1286,13 @@ String *Item_func_buffer::val_str(String
 
   if (dist > 0.0)
     mbr.buffer(dist);
+  else
+  {
+    /* This happens when dist is too far negative. */
+    if (mbr.xmax + dist < mbr.xmin || mbr.ymax + dist < mbr.ymin)
+      goto return_empty_result;
+  }
+
   collector.set_extent(mbr.xmin, mbr.xmax, mbr.ymin, mbr.ymax);
   /*
     If the distance given is 0, the Buffer function is in fact NOOP,
@@ -1313,6 +1320,7 @@ String *Item_func_buffer::val_str(String
     goto mem_error;
 
 
+return_empty_result:
   str_value->set_charset(&my_charset_bin);
   if (str_value->reserve(SRID_SIZE, 512))
     goto mem_error;



More information about the commits mailing list