From e927bda69f5213725c95615641db1bf511a9fcab Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Thu, 28 Mar 2013 17:37:29 +0200 Subject: Addendum #1 to the fix for bug #16451878 : GEOMETRY QUERY CRASHES SERVER Fixed the get_data_size() methods for multi-point features to check properly for end of their respective data arrays. Extended the point checking function to take a 3d optional argument so cases where there's additional data in each array element (besides the point data itself) can be covered by the helper function. Fixed the 3 cases where such offset was present to use the proper checking helper function. Test cases added. Fixed review comments. --- sql/spatial.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sql/spatial.h') diff --git a/sql/spatial.h b/sql/spatial.h index 075ae0ecc89..60a34852178 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -335,14 +335,17 @@ protected: Need to perform the calculation in logical units, since multiplication can overflow the size data type. - @arg data pointer to the begining of the points array - @arg expected_points number of points expected + @arg data pointer to the begining of the points array + @arg expected_points number of points expected + @arg extra_point_space extra space for each point element in the array @return true if there are not enough points */ - inline bool not_enough_points(const char *data, uint32 expected_points) const + inline bool not_enough_points(const char *data, uint32 expected_points, + uint32 extra_point_space = 0) const { return (m_data_end < data || - (expected_points > ((m_data_end - data) / POINT_DATA_SIZE))); + (expected_points > ((m_data_end - data) / + (POINT_DATA_SIZE + extra_point_space)))); } const char *m_data; const char *m_data_end; -- cgit v1.2.1