Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
423f37b9
Commit
423f37b9
authored
May 11, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
out-of-bound array access fixed
parent
5a0cbfea
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
mysql-test/r/type_float.result
mysql-test/r/type_float.result
+12
-0
mysql-test/t/type_float.test
mysql-test/t/type_float.test
+6
-0
sql/field.cc
sql/field.cc
+4
-2
No files found.
mysql-test/r/type_float.result
View file @
423f37b9
...
...
@@ -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;
mysql-test/t/type_float.test
View file @
423f37b9
...
...
@@ -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
...
...
sql/field.cc
View file @
423f37b9
...
...
@@ -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
];
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment