[MDEV-18873] Server crashes in Compare_identifiers::operator or in my_strcasecmp_utf8 upon ADD PERIOD IF NOT EXISTS with empty name Created: 2019-03-10  Updated: 2022-12-24  Resolved: 2022-08-26

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Parser, Versioned Tables
Affects Version/s: 10.4, 10.5
Fix Version/s: 10.4.27, 10.5.18, 10.6.10, 10.7.6, 10.8.5, 10.9.3, 10.10.2

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Nikita Malyavin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
Relates
relates to MDEV-29387 Period name with more than 32 symbols... Open
relates to MDEV-30297 Server crash / assertion failure in C... Open

 Description   

ALTER TABLE t ADD PERIOD IF NOT EXISTS FOR `` (s,e);

10.4 5a796f1f debug

#3  <signal handler called>
#4  0x000056225dec77ca in Compare_identifiers::operator() (this=0x7fd1a807a41f, a=..., b=...) at /data/src/10.4/sql/vers_string.h:42
#5  0x000056225ded034f in Lex_cstring_with_compare<Compare_identifiers>::streq (this=0x7fd198005e80, b=...) at /data/src/10.4/sql/vers_string.h:91
#6  0x000056225e0ec019 in LEX::add_period (this=0x7fd198004960, name=..., start=..., end=...) at /data/src/10.4/sql/sql_lex.h:4363
#7  0x000056225e0bd18f in MYSQLparse (thd=0x7fd198000b00) at /data/src/10.4/sql/sql_yacc.yy:6585
#8  0x000056225de49bd4 in parse_sql (thd=0x7fd198000b00, parser_state=0x7fd1a807c180, creation_ctx=0x0, do_pfs_digest=true) at /data/src/10.4/sql/sql_parse.cc:10247
#9  0x000056225de449c3 in mysql_parse (thd=0x7fd198000b00, rawbuf=0x7fd198015620 "ALTER TABLE t ADD PERIOD IF NOT EXISTS FOR `` (s,e)", length=51, parser_state=0x7fd1a807c180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8157
#10 0x000056225de301a5 in dispatch_command (command=COM_QUERY, thd=0x7fd198000b00, packet=0x7fd19800a781 "ALTER TABLE t ADD PERIOD IF NOT EXISTS FOR `` (s,e)", packet_length=51, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1829
#11 0x000056225de2e98b in do_command (thd=0x7fd198000b00) at /data/src/10.4/sql/sql_parse.cc:1358
#12 0x000056225dfa8703 in do_handle_one_connection (connect=0x562261131340) at /data/src/10.4/sql/sql_connect.cc:1399
#13 0x000056225dfa8474 in handle_one_connection (arg=0x562261131340) at /data/src/10.4/sql/sql_connect.cc:1302
#14 0x000056225e49e031 in pfs_spawn_thread (arg=0x5622612239b0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#15 0x00007fd1afbd9494 in start_thread (arg=0x7fd1a807d700) at pthread_create.c:333
#16 0x00007fd1adfbf93f in clone () from /lib/x86_64-linux-gnu/libc.so.6

10.4 5a796f1f non-debug

#2  <signal handler called>
#3  my_strcasecmp_utf8 (cs=<optimized out>, s=0x0, t=0x7f22140127e8 "") at /data/src/10.4/strings/ctype-utf8.c:5109
#4  0x000056491b01406e in operator() (this=<optimized out>, a=..., b=<synthetic pointer>) at /data/src/10.4/sql/vers_string.h:44
#5  streq (b=<synthetic pointer>, this=0x7f2214005b68) at /data/src/10.4/sql/vers_string.h:91
#6  LEX::add_period (this=0x7f2214004648, name=..., start=..., end=...) at /data/src/10.4/sql/sql_lex.h:4363
#7  0x000056491aff9c8e in MYSQLparse (thd=0x7f22140009a8) at /data/src/10.4/sql/sql_yacc.yy:6585
#8  0x000056491ae69945 in parse_sql (thd=thd@entry=0x7f22140009a8, parser_state=parser_state@entry=0x7f22301bf1d0, creation_ctx=creation_ctx@entry=0x0, do_pfs_digest=do_pfs_digest@entry=true) at /data/src/10.4/sql/sql_parse.cc:10247
#9  0x000056491ae69bf6 in mysql_parse (thd=thd@entry=0x7f22140009a8, rawbuf=<optimized out>, length=51, parser_state=parser_state@entry=0x7f22301bf1d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:8157
#10 0x000056491ae6c5a2 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f22140009a8, packet=packet@entry=0x7f2214009b59 "ALTER TABLE t ADD PERIOD IF NOT EXISTS FOR `` (s,e)", packet_length=packet_length@entry=51, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:1829
#11 0x000056491ae6d9f7 in do_command (thd=0x7f22140009a8) at /data/src/10.4/sql/sql_parse.cc:1358
#12 0x000056491af47f9c in do_handle_one_connection (connect=connect@entry=0x56491d3c8628) at /data/src/10.4/sql/sql_connect.cc:1399
#13 0x000056491af48104 in handle_one_connection (arg=arg@entry=0x56491d3c8628) at /data/src/10.4/sql/sql_connect.cc:1302
#14 0x000056491b2647b4 in pfs_spawn_thread (arg=0x56491d3fc9e8) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#15 0x00007f223751d494 in start_thread (arg=0x7f22301c0700) at pthread_create.c:333
#16 0x00007f223590393f in clone () from /lib/x86_64-linux-gnu/libc.so.6

ASAN crashes the same way as debug.



 Comments   
Comment by Nayuta Yanagisawa (Inactive) [ 2022-06-05 ]

nikitamalyavin We got a pull request for the issue: https://github.com/MariaDB/server/pull/2146

Comment by Nikita Malyavin [ 2022-08-26 ]

Fixed per Masashi Tomoka's contribution

Generated at Thu Feb 08 08:47:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.