diff options
Diffstat (limited to 'sql/item_geofunc.cc')
-rw-r--r-- | sql/item_geofunc.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 3e5856f6cb0..e67ab9115e9 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -1793,6 +1793,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, @@ -1820,6 +1827,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; |