summaryrefslogtreecommitdiff
path: root/sql/spatial.cc
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil.kalimullin@oracle.com>2012-03-05 21:58:07 +0400
committerRamil Kalimullin <ramil.kalimullin@oracle.com>2012-03-05 21:58:07 +0400
commit8aea62fa8a4ac6b065322814d2dcc2c2a9a7ec7e (patch)
treeddd8061d4f4c35cb933a6f2423df9395649709e2 /sql/spatial.cc
parent621db3d42ef19d8ff28da9968fcc47d952345a28 (diff)
downloadmariadb-git-8aea62fa8a4ac6b065322814d2dcc2c2a9a7ec7e.tar.gz
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. mysql-test/r/gis.result: Fix for BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS test result. mysql-test/t/gis.test: Fix for BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS test case. sql/spatial.cc: Fix for BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS check if a LINESTRING has at least one point as we rely on that further.
Diffstat (limited to 'sql/spatial.cc')
-rw-r--r--sql/spatial.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/spatial.cc b/sql/spatial.cc
index ed3d72b91ec..0d2dd81c71e 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -627,7 +627,8 @@ int Gis_line_string::is_closed(int *closed) const
return 0;
}
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;
/* Get first point */