Commit 7682d6c9 authored by unknown's avatar unknown
Browse files

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.
parent 8b077c2b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;