[MDEV-28062] Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on INSERT..SELECT Created: 2022-03-14  Updated: 2022-04-08  Resolved: 2022-04-08

Status: Closed
Project: MariaDB Server
Component/s: Character Sets, Data types
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Duplicate Votes: 0
Labels: affects-tests

Issue Links:
Blocks
is blocked by MDEV-28078 Garbage on multiple equal ENUMs with ... Closed
Duplicate
duplicates MDEV-28078 Garbage on multiple equal ENUMs with ... Closed
Issue split
split from MDEV-23210 Assertion `(length % 4) == 0' failed ... Closed

 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.



 Comments   
Comment by Alexander Barkov [ 2022-04-08 ]

This problem was split from MDEV-23210, then marked as possibly blocked by MDEV-28078, but then appeared to be just a duplicate for MDEV-28078.

Generated at Thu Feb 08 09:57:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.