Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4635

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • 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
    • Component/s: None
    • Labels:

      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

        Gliffy Diagrams

          Activity

          Hide
          elenst Elena Stepanova added a comment -

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

          Show
          elenst Elena Stepanova added a comment - Also reproducible on MySQL 5.1, 5.5, but not on 5.6, 5.7.
          Hide
          bar 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
          bar 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
          bar Alexander Barkov added a comment -

          Fixed. Pushed into 5.3.13 and 5.5.32.

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

            People

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

              Dates

              • Created:
                Updated:
                Resolved: