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

Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on INSERT

    XMLWordPrintable

Details

    Description

      Ref MDEV-23210. Debug regression in 10.4, and this one is also present in all MySQL debug versions.

      SET sql_mode='',character_set_connection=utf32;
      CREATE TABLE t (c ENUM ('','')) CHARACTER SET utf32 ENGINE=InnoDB;
      INSERT INTO t VALUES (DATE_FORMAT('2004-02-02','%W'));
      

      Leads to:

      10.10.0 081a284712bb661349e2e3802077b12211cede3e (Debug)

      mysqld: /test/10.10_dbg/strings/ctype-ucs2.c:2226: my_lengthsp_utf32: Assertion `(length % 4) == 0' failed.
      

      10.10.0 081a284712bb661349e2e3802077b12211cede3e (Debug)

      Core was generated by `/test/MD310522-mariadb-10.10.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x14c822175700 (LWP 3559645))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x000014c840b20859 in __GI_abort () at abort.c:79
      #2  0x000014c840b20729 in __assert_fail_base (fmt=0x14c840cb6588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x56289155baba "(length % 4) == 0", file=0x56289155ba48 "/test/10.10_dbg/strings/ctype-ucs2.c", line=2226, function=<optimized out>) at assert.c:92
      #3  0x000014c840b31fd6 in __GI___assert_fail (assertion=assertion@entry=0x56289155baba "(length % 4) == 0", file=file@entry=0x56289155ba48 "/test/10.10_dbg/strings/ctype-ucs2.c", line=line@entry=2226, function=function@entry=0x56289155c1b0 <__PRETTY_FUNCTION__.17507> "my_lengthsp_utf32") at assert.c:101
      #4  0x0000562890f469a7 in my_lengthsp_utf32 (cs=<optimized out>, ptr=<optimized out>, length=<optimized out>) at /test/10.10_dbg/strings/ctype-ucs2.c:2226
      #5  0x000056289078ff5a in charset_info_st::lengthsp (length=7, str=0x14c822173840 "", this=<optimized out>) at /test/10.10_dbg/include/m_ctype.h:699
      #6  Field_enum::store (this=0x14c79c027eb8, from=0x14c822173840 "", length=7, cs=0x56289196b100 <my_charset_utf32_general_ci>) at /test/10.10_dbg/sql/field.cc:9230
      #7  0x00005628907e1fb5 in Item::save_str_in_field (this=0x14c79c014a98, field=0x14c79c027eb8, no_conversions=<optimized out>) at /test/10.10_dbg/sql/sql_string.h:278
      #8  0x00005628906c15f8 in Type_handler_string_result::Item_save_in_field (this=<optimized out>, item=<optimized out>, field=<optimized out>, no_conversions=<optimized out>) at /test/10.10_dbg/sql/sql_type.cc:4338
      #9  0x00005628907c88d3 in Item::save_in_field (this=0x14c79c014a98, field=0x14c79c027eb8, no_conversions=<optimized out>) at /test/10.10_dbg/sql/item.cc:6836
      #10 0x000056289044b13b in fill_record (thd=thd@entry=0x14c79c000db8, table=table@entry=0x14c79c0210f8, ptr=0x14c79c027eb0, ptr@entry=0x14c79c027ea8, values=@0x14c79c0148a8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c79c014b78, last = 0x14c79c014b78, elements = 1}, <No data fields>}, ignore_errors=ignore_errors@entry=false, use_value=use_value@entry=false) at /test/10.10_dbg/sql/sql_base.cc:9104
      #11 0x000056289044b1fe in fill_record_n_invoke_before_triggers (thd=thd@entry=0x14c79c000db8, table=table@entry=0x14c79c0210f8, ptr=0x14c79c027ea8, values=@0x14c79c0148a8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c79c014b78, last = 0x14c79c014b78, elements = 1}, <No data fields>}, ignore_errors=ignore_errors@entry=false, event=event@entry=TRG_EVENT_INSERT) at /test/10.10_dbg/sql/sql_base.cc:9159
      #12 0x000056289048e479 in mysql_insert (thd=thd@entry=0x14c79c000db8, table_list=<optimized out>, fields=@0x14c79c005e90: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5628919a5a00 <end_of_list>, last = 0x14c79c005e90, elements = 0}, <No data fields>}, values_list=@0x14c79c005ed8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c79c014be8, last = 0x14c79c014be8, elements = 1}, <No data fields>}, update_fields=@0x14c79c005ec0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5628919a5a00 <end_of_list>, last = 0x14c79c005ec0, elements = 0}, <No data fields>}, update_values=@0x14c79c005ea8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5628919a5a00 <end_of_list>, last = 0x14c79c005ea8, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0) at /test/10.10_dbg/sql/sql_insert.cc:1075
      #13 0x00005628904d0803 in mysql_execute_command (thd=thd@entry=0x14c79c000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.10_dbg/sql/sql_parse.cc:4562
      #14 0x00005628904bce3a in mysql_parse (thd=thd@entry=0x14c79c000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14c822174470) at /test/10.10_dbg/sql/sql_parse.cc:8036
      #15 0x00005628904ca422 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14c79c000db8, packet=packet@entry=0x14c79c00b6d9 "INSERT INTO t VALUES (DATE_FORMAT('2004-02-02','%W'))", packet_length=packet_length@entry=53, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_class.h:1364
      #16 0x00005628904ccb2c in do_command (thd=0x14c79c000db8, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_parse.cc:1407
      #17 0x000056289062c3c0 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x562893699288, put_in_cache=put_in_cache@entry=true) at /test/10.10_dbg/sql/sql_connect.cc:1418
      #18 0x000056289062c8c9 in handle_one_connection (arg=0x562893699288) at /test/10.10_dbg/sql/sql_connect.cc:1312
      #19 0x000014c841031609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #20 0x000014c840c1d133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.4.26 (dbg), 10.5.17 (dbg), 10.6.9 (dbg), 10.7.5 (dbg), 10.8.4 (dbg), 10.9.2 (dbg), 10.10.0 (dbg)
      MySQL: 5.5.62 (dbg), 5.6.51 (dbg), 5.7.38 (dbg), 8.0.29 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.3.36 (dbg), 10.3.36 (opt), 10.4.26 (opt), 10.5.17 (opt), 10.6.9 (opt), 10.7.5 (opt), 10.8.4 (opt), 10.9.2 (opt), 10.10.0 (opt)
      MySQL: 5.5.62 (opt), 5.6.51 (opt), 5.7.38 (opt), 8.0.29 (opt)

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.