Commit 15a7335d authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy.

        Forgotten DBUG_ASSERT should be replaced with the 'return error'.
parent 2cd7cf8f
......@@ -1102,4 +1102,10 @@ NULL
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1)
NULL
#
# MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
#
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )))
NULL
End of 5.1 tests
......@@ -834,4 +834,9 @@ select envelope(0x0100000000030000000100000000000010);
select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
--echo #
--echo # MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
--echo #
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
--echo End of 5.1 tests
......@@ -972,13 +972,11 @@ int Gis_polygon::centroid_xy(double *x, double *y) const
const char *data= m_data;
bool first_loop= 1;
if (no_data(data, 4))
if (no_data(data, 4) ||
(n_linear_rings= uint4korr(data)) == 0)
return 1;
n_linear_rings= uint4korr(data);
data+= 4;
DBUG_ASSERT(n_linear_rings > 0);
while (n_linear_rings--)
{
uint32 n_points, org_n_points;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment