Commit a11e04c8 authored by unknown's avatar unknown

out-of-bound array access fixed

parent 75a87de0
......@@ -105,6 +105,18 @@ select min(a) from t1;
min(a)
-0.010
drop table t1;
create table t1 (a float(200,100), b double(200,100));
insert t1 values (1.0, 2.0);
select * from t1;
a b
1.000000000000000000000000000000 2.000000000000000000000000000000
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` float(200,30) default NULL,
`b` double(200,30) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f'
drop table if exists t1;
......@@ -54,6 +54,12 @@ select a from t1 order by a;
select min(a) from t1;
drop table t1;
create table t1 (a float(200,100), b double(200,100));
insert t1 values (1.0, 2.0);
select * from t1;
show create table t1;
drop table t1;
# Errors
--error 1063
......
......@@ -2307,7 +2307,8 @@ int Field_float::store(double nr)
}
else
{
max_value= (log_10[field_length]-1)/log_10[dec];
uint tmp=min(field_length,array_elements(log_10)-1);
max_value= (log_10[tmp]-1)/log_10[dec];
/*
The following comparison is needed to not get an overflow if nr
is close to FLT_MAX
......@@ -2607,7 +2608,8 @@ int Field_double::store(double nr)
}
else
{
max_value= (log_10[field_length]-1)/log_10[dec];
uint tmp=min(field_length,array_elements(log_10)-1);
max_value= (log_10[tmp]-1)/log_10[dec];
if (fabs(nr) < DBL_MAX/10.0e+32)
nr= floor(nr*log_10[dec]+0.5)/log_10[dec];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment