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

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

    XMLWordPrintable

Details

    Description

      This problem was originally reported in MDEV-23210, but it's a separate issue. Creating a dedicated MDEV.

      Note, the ENGINE=InnoDB part is required to reproduce the crash. It seems to work fine with ENGINE=MyISAM and ENGINE=HEAP.

      The problem is repeatable with any utf32 collation.

      SET sql_mode='';
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (
        HOST CHAR DEFAULT '%',
        USER CHAR DEFAULT '%',
        ROLE CHAR DEFAULT '%',
        ENABLED ENUM ('a','a') DEFAULT 'a',
        HISTORY ENUM ('a','a') DEFAULT 'a'
      ) COLLATE=utf32_general_ci ENGINE=InnoDB; 
      INSERT INTO t1 SELECT * FROM t1;
      

      crashes the server with this stack trace:

      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x00007ffff75d18d9 in __GI_abort () at abort.c:79
      #2  0x00007ffff75d17a9 in __assert_fail_base (
          fmt=0x7ffff773caf8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
          assertion=0x18315fe "(length % 4) == 0", 
          file=0x1831420 "/home/bar/maria-git/server.10.3.utf32/strings/ctype-ucs2.c", line=2231, function=<optimized out>) at assert.c:92
      #3  0x00007ffff75e0a66 in __GI___assert_fail (
          assertion=0x18315fe "(length % 4) == 0", 
          file=0x1831420 "/home/bar/maria-git/server.10.3.utf32/strings/ctype-ucs2.c", line=2231, function=0x1831dd0 <__PRETTY_FUNCTION__.14733> "my_lengthsp_utf32")
          at assert.c:101
      #4  0x000000000130987b in my_lengthsp_utf32 (
          cs=0x1cb5160 <my_charset_utf32_unicode_nopad_ci>, ptr=0x7fff7c0466f2 "", 
          length=2)
          at /home/bar/maria-git/server.10.3.utf32/strings/ctype-ucs2.c:2231
      #5  0x0000000000a7015e in Field_enum::store (this=0x7fff7c058a10, 
          from=0x7fff7c0466f2 "", length=2, 
          cs=0x1cb5160 <my_charset_utf32_unicode_nopad_ci>)
          at /home/bar/maria-git/server.10.3.utf32/sql/field.cc:9247
      #6  0x0000000000a79aa0 in Field::save_in_field_str (this=0x7fff7c054b78, 
          to=0x7fff7c058a10) at /home/bar/maria-git/server.10.3.utf32/sql/field.h:632
      #7  0x0000000000a7ebf8 in Field_enum::save_in_field (this=0x7fff7c054b78, 
          to=0x7fff7c058a10)
          at /home/bar/maria-git/server.10.3.utf32/sql/field.h:4051
      #8  0x0000000000a7eb7e in Field_enum::store_field (this=0x7fff7c058a10, 
          from=0x7fff7c054b78)
          at /home/bar/maria-git/server.10.3.utf32/sql/field.h:4045
      #9  0x0000000000a82fd5 in field_conv_incompatible (to=0x7fff7c058a10, 
          from=0x7fff7c054b78)
          at /home/bar/maria-git/server.10.3.utf32/sql/field_conv.cc:836
      #10 0x0000000000a83031 in field_conv (to=0x7fff7c058a10, from=0x7fff7c054b78)
          at /home/bar/maria-git/server.10.3.utf32/sql/field_conv.cc:849
      

      Note, with ENGINE=MyISAM it does not crash.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.