summaryrefslogtreecommitdiff
path: root/sql/item_geofunc.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2015-02-10 16:16:31 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2015-02-10 16:16:31 +0400
commitcfb7d5d78a8aa6a683cd7a2f745d98ecfaca0100 (patch)
tree4a884ae4192a53b4c48b48a6d2a1046c848386f2 /sql/item_geofunc.cc
parent552f1b350587a2db6c8d8c6596983da1b1d87e73 (diff)
downloadmariadb-git-cfb7d5d78a8aa6a683cd7a2f745d98ecfaca0100.tar.gz
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.
Diffstat (limited to 'sql/item_geofunc.cc')
-rw-r--r--sql/item_geofunc.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index a38e9d416a7..5e1c0add54b 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -1286,6 +1286,13 @@ String *Item_func_buffer::val_str(String *str_value)
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 *str_value)
goto mem_error;
+return_empty_result:
str_value->set_charset(&my_charset_bin);
if (str_value->reserve(SRID_SIZE, 512))
goto mem_error;