diff options
author | Ramil Kalimullin <ramil@mysql.com> | 2011-03-21 09:21:14 +0300 |
---|---|---|
committer | Ramil Kalimullin <ramil@mysql.com> | 2011-03-21 09:21:14 +0300 |
commit | 1077c85fe3450b2a3ae73f7f01cdaf097417f998 (patch) | |
tree | 6b1dd84f127f10fb5f814b21833a5eb4b8e0671f /sql/spatial.cc | |
parent | 3e97851eb6569a113a9d6e888af7dcbf5eb65082 (diff) | |
download | mariadb-git-1077c85fe3450b2a3ae73f7f01cdaf097417f998.tar.gz |
Fix for bug#51875/#11759554 backported from mysql-5.1.
Diffstat (limited to 'sql/spatial.cc')
-rw-r--r-- | sql/spatial.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/spatial.cc b/sql/spatial.cc index 6e1da589527..b0963206271 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -519,7 +519,7 @@ uint Gis_line_string::init_from_wkb(const char *wkb, uint len, n_points= wkb_get_uint(wkb, bo); proper_length= 4 + n_points * POINT_DATA_SIZE; - if (len < proper_length || res->reserve(proper_length)) + if (!n_points || len < proper_length || res->reserve(proper_length)) return 0; res->q_append(n_points); @@ -737,7 +737,9 @@ uint Gis_polygon::init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, if (len < 4) return 0; - n_linear_rings= wkb_get_uint(wkb, bo); + if (!(n_linear_rings= wkb_get_uint(wkb, bo))) + return 0; + if (res->reserve(4, 512)) return 0; wkb+= 4; |