[MDEV-4635] Crash in UNIX_TIMESTAMP(STR_TO_DATE('2020','%Y')) Created: 2013-06-10  Updated: 2013-06-18  Resolved: 2013-06-18

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.3, 5.5.31, 5.1.67, 5.2.14, 5.3.12
Fix Version/s: 10.0.4, 5.5.32, 5.3.13

Type: Bug Priority: Critical
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: upstream


 Description   

This SQL script crashes the server (debug build):

SET TIME_ZONE='+02:00'
SELECT UNIX_TIMESTAMP(STR_TO_DATE('2020','%Y'));

Stack trace:

#4 0x00000000006df193 in sec_since_epoch (year=2020, mon=0, mday=0, hour=0, min=0, sec=0)
at /home/bar/maria-bzr/maria-10.0-connect/sql/tztime.cc:799
#5 0x00000000006df9f9 in Time_zone_offset::TIME_to_gmt_sec (this=0x2887d40,
t=0x7fffcc2e92f0, error_code=0x7fffcc2e9324)
at /home/bar/maria-bzr/maria-10.0-connect/sql/tztime.cc:1385
#6 0x00000000006dc801 in TIME_to_timestamp (thd=0x2b1b920, t=0x7fffcc2e92f0,
error_code=0x7fffcc2e9324)
at /home/bar/maria-bzr/maria-10.0-connect/sql/sql_time.cc:420
#7 0x000000000086d016 in Item_func_unix_timestamp::get_timestamp_value (
this=0x7fff900067d8, seconds=0x7fffcc2e9350, second_part=0x7fffcc2e9358)
at /home/bar/maria-bzr/maria-10.0-connect/sql/item_timefunc.cc:1197



 Comments   
Comment by Elena Stepanova [ 2013-06-10 ]

Also reproducible on MySQL 5.1, 5.5, but not on 5.6, 5.7.

Comment by Alexander Barkov [ 2013-06-13 ]

MySQL-5.6 correctly returns 0:

mysql> SET TIME_ZONE='+02:00'; SELECT VERSION(), UNIX_TIMESTAMP(STR_TO_DATE('2020','%Y'));
Query OK, 0 rows affected (0.00 sec)

---------------------------------------------------+

VERSION() UNIX_TIMESTAMP(STR_TO_DATE('2020','%Y'))

---------------------------------------------------+

5.6.11 0

---------------------------------------------------+

Comment by Alexander Barkov [ 2013-06-18 ]

Fixed. Pushed into 5.3.13 and 5.5.32.

Generated at Thu Feb 08 06:57:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.