Commit 44d88da5 authored by Ramil Kalimullin's avatar Ramil Kalimullin

Fix for BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS

Problem:      
lack of incoming geometry data validation may 
lead to a server crash when ISCLOSED() function called.

Solution:
necessary incoming data check added.
parent 98642459
...@@ -1075,4 +1075,10 @@ SPATIAL INDEX i1 (col1, col2) ...@@ -1075,4 +1075,10 @@ SPATIAL INDEX i1 (col1, col2)
); );
ERROR HY000: Incorrect arguments to SPATIAL INDEX ERROR HY000: Incorrect arguments to SPATIAL INDEX
DROP TABLE t0, t1, t2; DROP TABLE t0, t1, t2;
#
# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
#
SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)))
NULL
End of 5.1 tests End of 5.1 tests
...@@ -812,4 +812,11 @@ CREATE TABLE t3 ( ...@@ -812,4 +812,11 @@ CREATE TABLE t3 (
# cleanup # cleanup
DROP TABLE t0, t1, t2; DROP TABLE t0, t1, t2;
--echo #
--echo # BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
--echo #
SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -627,7 +627,8 @@ int Gis_line_string::is_closed(int *closed) const ...@@ -627,7 +627,8 @@ int Gis_line_string::is_closed(int *closed) const
return 0; return 0;
} }
data+= 4; data+= 4;
if (no_data(data, SIZEOF_STORED_DOUBLE * 2 * n_points)) if (n_points == 0 ||
no_data(data, SIZEOF_STORED_DOUBLE * 2 * n_points))
return 1; return 1;
/* Get first point */ /* Get first point */
......
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