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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
bf7515c3
Commit
bf7515c3
authored
Jul 07, 2005
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #10891 (string->decimal conversion crashes server)
parent
bb9a634e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
mysql-test/r/type_newdecimal.result
mysql-test/r/type_newdecimal.result
+3
-0
mysql-test/t/type_newdecimal.test
mysql-test/t/type_newdecimal.test
+5
-0
strings/decimal.c
strings/decimal.c
+14
-5
No files found.
mysql-test/r/type_newdecimal.result
View file @
bf7515c3
...
...
@@ -934,3 +934,6 @@ select * from t1;
col1
-9223372036854775808
drop table t1;
select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15));
cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15))
0.000000000100000
mysql-test/t/type_newdecimal.test
View file @
bf7515c3
...
...
@@ -973,3 +973,8 @@ create table t1 (col1 bigint default -9223372036854775808);
insert
into
t1
values
(
default
);
select
*
from
t1
;
drop
table
t1
;
#
# Bug #10891 (converting to decimal crashes server)
#
select
cast
(
'1.00000001335143196001808973960578441619873046875E-10'
as
decimal
(
30
,
15
));
strings/decimal.c
View file @
bf7515c3
...
...
@@ -739,11 +739,20 @@ int decimal_shift(decimal_t *dec, int shift)
beg
=
ROUND_UP
(
beg
+
1
)
-
1
;
end
=
ROUND_UP
(
end
)
-
1
;
DBUG_ASSERT
(
new_point
>=
0
);
new_point
=
ROUND_UP
(
new_point
)
-
1
;
for
(;
new_point
>
end
;
new_point
--
)
dec
->
buf
[
new_point
]
=
0
;
for
(;
new_point
<
beg
;
new_point
++
)
dec
->
buf
[
new_point
]
=
0
;
/* We don't want negative new_point below */
if
(
new_point
!=
0
)
new_point
=
ROUND_UP
(
new_point
)
-
1
;
if
(
new_point
>
end
)
do
{
dec
->
buf
[
new_point
]
=
0
;
}
while
(
--
new_point
>
end
);
else
for
(;
new_point
<
beg
;
new_point
++
)
dec
->
buf
[
new_point
]
=
0
;
dec
->
intg
=
digits_int
;
dec
->
frac
=
digits_frac
;
return
err
;
...
...
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