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

Server crashes on INSERT to a column with DEFAULT @a:=''

    XMLWordPrintable

    Details

      Description

      I run this script:

      CREATE OR REPLACE TABLE t1 (a INT DEFAULT @a:='');
      INSERT INTO t1 VALUES ();
      

      ERROR 1366 (22007): Incorrect integer value: '' for column `test`.`t1`.`a` at row 1
      

      The error is OK. Looks fine so far.

      Now I quit the client, start a new session, and in the new session run this statement again:

      INSERT INTO t1 VALUES ();
      

      The server crashes with the following stack:

      #0  0x000000000105feb7 in sf_malloc_usable_size (ptr=0x8f8f8f8f8f8f8f8f, 
          is_thread_specific=0x7ffff4d8228f "") at /home/bar/maria-git/server.10.2/mysys/safemalloc.c:215
      #1  0x000000000104d5f4 in my_free (ptr=0x8f8f8f8f8f8f8f8f)
          at /home/bar/maria-git/server.10.2/mysys/my_malloc.c:216
      #2  0x00000000009dd297 in update_hash (entry=0x2323560, set_null=false, ptr=0x7fff60042c88, length=1, 
          type=STRING_RESULT, cs=0x18dbbc0 <my_charset_latin1>, unsigned_arg=false)
          at /home/bar/maria-git/server.10.2/sql/item_func.cc:4859
      #3  0x00000000009dd497 in Item_func_set_user_var::update_hash (this=0x7fff60042d18, ptr=0x7fff60042c88, 
          length=0, res_type=STRING_RESULT, cs=0x18dbbc0 <my_charset_latin1>, unsigned_arg=false)
          at /home/bar/maria-git/server.10.2/sql/item_func.cc:4915
      #4  0x00000000009ddf99 in Item_func_set_user_var::update (this=0x7fff60042d18)
          at /home/bar/maria-git/server.10.2/sql/item_func.cc:5179
      #5  0x00000000009de883 in Item_func_set_user_var::save_in_field (this=0x7fff60042d18, 
          field=0x7fff60042b20, no_conversions=false, can_use_result_field=true)
          at /home/bar/maria-git/server.10.2/sql/item_func.cc:5378
      #6  0x00000000009e6874 in Item_func_set_user_var::save_in_field (this=0x7fff60042d18, 
          field=0x7fff60042b20, no_conversions=false) at /home/bar/maria-git/server.10.2/sql/item_func.h:1988
      #7  0x00000000007fe3d0 in TABLE::update_default_fields (this=0x7fff6004c7e0, ignore_errors=false)
          at /home/bar/maria-git/server.10.2/sql/table.cc:7833
      #8  0x000000000069372e in fill_record (thd=0x7fff60000d90, table_arg=0x7fff6004c7e0, fields=..., 
          values=..., ignore_errors=false, update=false)
          at /home/bar/maria-git/server.10.2/sql/sql_base.cc:8110
      #9  0x0000000000693bfe in fill_record_n_invoke_before_triggers (thd=0x7fff60000d90, 
          table=0x7fff6004c7e0, fields=..., values=..., ignore_errors=false, event=TRG_EVENT_INSERT)
          at /home/bar/maria-git/server.10.2/sql/sql_base.cc:8243
      #10 0x00000000006d0cfa in mysql_insert (thd=0x7fff60000d90, table_list=0x7fff60014718, fields=..., 
          values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false)
          at /home/bar/maria-git/server.10.2/sql/sql_insert.cc:966
      #11 0x00000000006f6f6b in mysql_execute_command (thd=0x7fff60000d90)
          at /home/bar/maria-git/server.10.2/sql/sql_parse.cc:4167
      #12 0x00000000007021a9 in mysql_parse (thd=0x7fff60000d90, 
          rawbuf=0x7fff60014638 "INSERT INTO t1 VALUES ()", length=24, parser_state=0x7ffff4d83600, 
          is_com_multi=false, is_next_command=false) at /home/bar/maria-git/server.10.2/sql/sql_parse.cc:7741
      #13 0x00000000006f0c47 in dispatch_command (command=COM_QUERY, thd=0x7fff60000d90, 
          packet=0x7fff600529d1 "INSERT INTO t1 VALUES ()", packet_length=24, is_com_multi=false, 
          is_next_command=false) at /home/bar/maria-git/server.10.2/sql/sql_parse.cc:1831
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: