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
5aa0edf3
Commit
5aa0edf3
authored
May 06, 2005
by
holyfoot@hf-ibm.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trimmed fix for bug #9546 (Crashing with huge decimals)
parent
82f4a0b0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
4 deletions
+27
-4
mysql-test/r/type_newdecimal.result
mysql-test/r/type_newdecimal.result
+11
-0
mysql-test/t/type_newdecimal.test
mysql-test/t/type_newdecimal.test
+6
-0
sql/my_decimal.cc
sql/my_decimal.cc
+3
-3
strings/decimal.c
strings/decimal.c
+7
-1
No files found.
mysql-test/r/type_newdecimal.result
View file @
5aa0edf3
...
...
@@ -846,3 +846,14 @@ set sql_mode='';
select 0/0;
0/0
NULL
select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 as x;
x
999999999999999999999999999999999999999999999999999999999999999999999999999999999
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x;
x
NULL
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: ''
mysql-test/t/type_newdecimal.test
View file @
5aa0edf3
...
...
@@ -876,3 +876,9 @@ select 10.3330000000000/12.34500000;
set
sql_mode
=
''
;
select
0
/
0
;
#
# bug #9546
#
select
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
as
x
;
select
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
+
1
as
x
;
sql/my_decimal.cc
View file @
5aa0edf3
...
...
@@ -43,9 +43,9 @@ int decimal_operation_results(int result)
break
;
case
E_DEC_OVERFLOW
:
push_warning_printf
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_ERROR
,
ER_WARN_DATA_OUT_OF_RANG
E
,
ER
(
ER_WARN_DATA_OUT_OF_RANG
E
),
"
"
,
(
long
)
-
1
);
ER_TRUNCATED_WRONG_VALU
E
,
ER
(
ER_TRUNCATED_WRONG_VALU
E
),
"
DECIMAL"
,
""
);
break
;
case
E_DEC_DIV_ZERO
:
push_warning_printf
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_ERROR
,
...
...
strings/decimal.c
View file @
5aa0edf3
...
...
@@ -1612,13 +1612,19 @@ static int do_add(decimal_t *from1, decimal_t *from2, decimal_t *to)
x
=
intg1
>
intg2
?
from1
->
buf
[
0
]
:
intg2
>
intg1
?
from2
->
buf
[
0
]
:
from1
->
buf
[
0
]
+
from2
->
buf
[
0
]
;
if
(
unlikely
(
x
>
DIG_MA
SK
*
9
))
/* yes, there is */
if
(
unlikely
(
x
>
DIG_MA
X
-
1
))
/* yes, there is */
{
intg0
++
;
to
->
buf
[
0
]
=
0
;
/* safety */
}
FIX_INTG_FRAC_ERROR
(
to
->
len
,
intg0
,
frac0
,
error
);
if
(
unlikely
(
error
==
E_DEC_OVERFLOW
))
{
max_decimal
(
to
->
len
*
DIG_PER_DEC1
,
0
,
to
);
return
error
;
}
buf0
=
to
->
buf
+
intg0
+
frac0
;
to
->
sign
=
from1
->
sign
;
...
...
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