summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-01-13 00:52:19 +0100
committerunknown <jimw@mysql.com>2005-01-13 00:52:19 +0100
commit7682d6c9cfa7081dc88b744d1a4f343367309c2b (patch)
tree9f8ef6b6c536ca7d3ea861b235140c545bf98fca /sql/field.cc
parent8b077c2b9fb9fab697a5136db22e1695da3c6ccb (diff)
downloadmariadb-git-7682d6c9cfa7081dc88b744d1a4f343367309c2b.tar.gz
Small fix for Field_str::store() to avoid trying to read past beginning
of log_10 array. sql/field.cc: Avoid pointless calculation for really short fields, and what could be an attempt to access outside the bounds of the log_10 array.
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 2f2115e55dd..fec65438e4d 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4307,7 +4307,7 @@ int Field_str::store(double nr)
*/
double anr= fabs(nr);
int neg= (nr < 0.0) ? 1 : 0;
- if (field_length < 32 &&
+ if (field_length > 4 && field_length < 32 &&
(anr < 1.0 ? anr > 1/(log_10[max(0,field_length-neg-2)]) /* -2 for "0." */
: anr < log_10[field_length-neg]-1))
use_scientific_notation= FALSE;