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
c2509a15
Commit
c2509a15
authored
Oct 10, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-13972 crash in Item_func_sec_to_time::get_date
parent
e30b6a98
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
3 deletions
+62
-3
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ucs.result
+8
-0
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+20
-0
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_ucs.test
+7
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+15
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+12
-3
No files found.
mysql-test/r/ctype_ucs.result
View file @
c2509a15
...
...
@@ -4367,5 +4367,13 @@ NO_ENGINE_SUBSTITUTION
SET sql_mode=DEFAULT;
SET NAMES utf8;
#
# MDEV-13972 crash in Item_func_sec_to_time::get_date
#
SELECT SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2));
SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2))
838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '77760000'
#
# End of 5.5 tests
#
mysql-test/r/func_time.result
View file @
c2509a15
...
...
@@ -2638,5 +2638,25 @@ a
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# MDEV-13972 crash in Item_func_sec_to_time::get_date
#
DO TO_DAYS(SEC_TO_TIME(TIME(CEILING(UUID()))));
DO TO_DAYS(SEC_TO_TIME(MAKEDATE('',RAND(~('')))));
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
Warning 1292 Truncated incorrect INTEGER value: ''
Warning 1292 Truncated incorrect INTEGER value: ''
Warning 1292 Truncated incorrect time value: '20000101'
SELECT TO_DAYS(SEC_TO_TIME(MAKEDATE(0,RAND(~0))));
TO_DAYS(SEC_TO_TIME(MAKEDATE(0,RAND(~0))))
0
Warnings:
Warning 1292 Truncated incorrect time value: '20000101'
SELECT SEC_TO_TIME(MAKEDATE(0,RAND(~0)));
SEC_TO_TIME(MAKEDATE(0,RAND(~0)))
838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '20000101'
#
# End of 5.5 tests
#
mysql-test/t/ctype_ucs.test
View file @
c2509a15
...
...
@@ -862,6 +862,13 @@ SELECT @@sql_mode;
SET
sql_mode
=
DEFAULT
;
SET
NAMES
utf8
;
--
echo
#
--
echo
# MDEV-13972 crash in Item_func_sec_to_time::get_date
--
echo
#
SELECT
SEC_TO_TIME
(
CONVERT
(
900
*
24
*
60
*
60
USING
ucs2
));
--
echo
#
--
echo
# End of 5.5 tests
--
echo
#
mysql-test/t/func_time.test
View file @
c2509a15
...
...
@@ -1615,6 +1615,21 @@ SELECT * FROM t1;
DROP
TABLE
t1
;
SET
sql_mode
=
DEFAULT
;
--
echo
#
--
echo
# MDEV-13972 crash in Item_func_sec_to_time::get_date
--
echo
#
# The below query can return warning sporadically
--
disable_warnings
DO
TO_DAYS
(
SEC_TO_TIME
(
TIME
(
CEILING
(
UUID
()))));
--
enable_warnings
DO
TO_DAYS
(
SEC_TO_TIME
(
MAKEDATE
(
''
,
RAND
(
~
(
''
)))));
SELECT
TO_DAYS
(
SEC_TO_TIME
(
MAKEDATE
(
0
,
RAND
(
~
0
))));
SELECT
SEC_TO_TIME
(
MAKEDATE
(
0
,
RAND
(
~
0
)));
--
echo
#
--
echo
# End of 5.5 tests
--
echo
#
sql/item_timefunc.cc
View file @
c2509a15
...
...
@@ -1733,9 +1733,18 @@ bool Item_func_sec_to_time::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
ltime
->
hour
=
TIME_MAX_HOUR
+
1
;
check_time_range
(
ltime
,
decimals
,
&
unused
);
if
(
!
err
)
{
ErrConvInteger
err2
(
sec
,
unsigned_flag
);
make_truncated_value_warning
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
&
err2
,
MYSQL_TIMESTAMP_TIME
,
NullS
);
}
else
{
ErrConvString
err2
(
err
);
make_truncated_value_warning
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
err
->
ptr
(),
err
->
length
(),
MYSQL_TIMESTAMP_TIME
,
NullS
);
&
err2
,
MYSQL_TIMESTAMP_TIME
,
NullS
);
}
return
0
;
}
...
...
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