MariaDB Development
  1. MariaDB Development
  2. MDEV-4635

Crash in UNIX_TIMESTAMP(STR_TO_DATE('2020','%Y'))

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 10.0.3, 5.5.31, 5.3.12, 5.2.14, 5.1.67
    • Fix Version/s: 10.0.4, 5.5.32, 5.3.13
    • Labels:
    • Global Rank:
      3146

      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

        Activity

        Hide
        Elena Stepanova added a comment -

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

        Show
        Elena Stepanova added a comment - Also reproducible on MySQL 5.1, 5.5, but not on 5.6, 5.7.
        Hide
        Alexander Barkov added a comment -

        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

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

        Show
        Alexander Barkov added a comment - 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 ---------- -----------------------------------------+
        Hide
        Alexander Barkov added a comment -

        Fixed. Pushed into 5.3.13 and 5.5.32.

        Show
        Alexander Barkov added a comment - Fixed. Pushed into 5.3.13 and 5.5.32.

          People

          • Assignee:
            Alexander Barkov
            Reporter:
            Alexander Barkov
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: