summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2014-11-15 21:30:16 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2014-11-15 21:30:16 +0400
commitc9742ceac5bd682e24a435c36524305eecca7950 (patch)
treeef3c758ff0135c6f1b9a9a3137c0d125097dfa5d /sql
parent50c5339272403dfac435c7df632274ad8b18aaf8 (diff)
downloadmariadb-git-c9742ceac5bd682e24a435c36524305eecca7950.tar.gz
MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0)).
Fixed the case when a polygon contains a single-point ring.
Diffstat (limited to 'sql')
-rw-r--r--sql/spatial.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 551c79d4d90..2c838379505 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -1233,11 +1233,15 @@ int Gis_polygon::store_shapes(Gcalc_shape_transporter *trn) const
trn->start_ring();
get_point(&first_x, &first_y, data);
data+= POINT_DATA_SIZE;
- n_points--;
+
prev_x= first_x;
prev_y= first_y;
if (trn->add_point(first_x, first_y))
return 1;
+
+ if (--n_points == 0)
+ goto single_point_ring;
+
while (--n_points)
{
double x, y;
@@ -1262,6 +1266,8 @@ int Gis_polygon::store_shapes(Gcalc_shape_transporter *trn) const
return 1;
}
data+= POINT_DATA_SIZE;
+
+single_point_ring:
trn->complete_ring();
}