summaryrefslogtreecommitdiff
path: root/sql/spatial.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-07-05 18:24:48 +0300
committerunknown <gkodinov/kgeorge@magare.gmz>2007-07-05 18:24:48 +0300
commit6139d34c92bf9c2e1a2fe19b41c7e19f5cbe2787 (patch)
tree6e27b6c33885046dbc55c5dac0b78be8aee3489c /sql/spatial.cc
parente0f93ca8c1955cc2766c224703a278e66d9c05bc (diff)
downloadmariadb-git-6139d34c92bf9c2e1a2fe19b41c7e19f5cbe2787.tar.gz
Bug #29166:
AsText() needs to know the maximum number of characters a IEEE double precision value can occupy to make sure there's enough buffer space. The number was too small to hold all possible values and this caused buffer overruns. Fixed by correcting the calculation of the maximum digits in a string representation of an IEEE double precision value as printed by String::qs_append(double). mysql-test/r/gis.result: Bug #29166: test case mysql-test/t/gis.test: Bug #29166: test case sql/spatial.cc: Bug #29166: correct calculation of the maximum digits in a string representation of a double
Diffstat (limited to 'sql/spatial.cc')
-rw-r--r--sql/spatial.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 939e7d2a3b4..69d0c15748a 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -17,7 +17,28 @@
#ifdef HAVE_SPATIAL
-#define MAX_DIGITS_IN_DOUBLE 16
+/*
+ exponential notation :
+ 1 sign
+ 1 number before the decimal point
+ 1 decimal point
+ 14 number of significant digits (see String::qs_append(double))
+ 1 'e' sign
+ 1 exponent sign
+ 3 exponent digits
+ ==
+ 22
+
+ "f" notation :
+ 1 optional 0
+ 1 sign
+ 14 number significant digits (see String::qs_append(double) )
+ 1 decimal point
+ ==
+ 17
+*/
+
+#define MAX_DIGITS_IN_DOUBLE 22
/***************************** Gis_class_info *******************************/