diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2011-06-30 19:24:52 +0500 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2011-06-30 19:24:52 +0500 |
commit | a9a6597d598c735ba6b8a136864b888d8d626b70 (patch) | |
tree | 13c21e625bae9a2a1b4cf6afed672782ca1e5d4a /sql/item_geofunc.cc | |
parent | 4f49cdf8d303b431343bbc77428169fdfcaae34c (diff) | |
download | mariadb-git-a9a6597d598c735ba6b8a136864b888d8d626b70.tar.gz |
fix for bug #201189 ST_BUFFER asserts if radius = 0.
Internal caclucations can't handle zero distance properly.
As the ST_BUFFER(geom, 0) is in fact NOOP, we'll just return the
'geom' as the result here.
per-file comments:
mysql-test/r/gis-precise.result
fix for bug #201189 ST_BUFFER asserts if radius = 0.
test result updated.
mysql-test/t/gis-precise.test
fix for bug #201189 ST_BUFFER asserts if radius = 0.
test case added.
sql/item_geofunc.cc
fix for bug #201189 ST_BUFFER asserts if radius = 0.
return the first argument as the result of the ST_BUFFER, if
the distance is 0 there.
Diffstat (limited to 'sql/item_geofunc.cc')
-rw-r--r-- | sql/item_geofunc.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 9432de95182..f65df790dfb 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -1406,6 +1406,18 @@ String *Item_func_buffer::val_str(String *str_value) !(g= Geometry::construct(&buffer, obj->ptr(), obj->length()))) goto mem_error; + /* + If the distance given is 0, the Buffer function is in fact NOOP, + so it's natural just to return the argument1. + Besides, internal calculations here can't handle zero distance anyway. + */ + if (fabs(dist) < GIS_ZERO) + { + null_value= 0; + str_result= obj; + goto mem_error; + } + if (func.reserve_op_buffer(2)) goto mem_error; /* will specify operands later */ |