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

Assertion `!str || str != Ptr' and Assertion `!str || str != Ptr || !is_alloced()' failed in String::copy

    XMLWordPrintable

Details

    Description

      USE test;
      SET collation_connection='utf16_general_ci';
      SET sql_buffer_result=1;
      CREATE TABLE t(c INT);
      INSERT INTO t VALUES(NULL);
      SELECT PASSWORD(c) FROM t;
      

      Leads to:

      10.5.4 6877ef9a7c9c7ee55d67e4baaf4e8f7b874c9f89

      mysqld: /test/10.5_dbg/sql/sql_string.cc:430: bool String::copy(const char*, size_t, CHARSET_INFO*, CHARSET_INFO*, uint*): Assertion `!str || str != Ptr' failed.
      

      10.5.4 6877ef9a7c9c7ee55d67e4baaf4e8f7b874c9f89

      Core was generated by `/test/MD060620-mariadb-10.5.4-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x14b31a50c700 (LWP 220065))]
      (gdb) bt
      (gdb) (gdb) #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x0000563ecc1de00d in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
      #2  0x0000563ecb987bbc in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x000014b322e65801 in __GI_abort () at abort.c:79
      #6  0x000014b322e5539a in __assert_fail_base (fmt=0x14b322fdc7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x563ecc376b71 "!str || str != Ptr", file=file@entry=0x563ecc376c60 "/test/10.5_dbg/sql/sql_string.cc", line=line@entry=430, function=function@entry=0x563ecc376fc0 <String::copy(char const*, unsigned long, charset_info_st const*, charset_info_st const*, unsigned int*)::__PRETTY_FUNCTION__> "bool String::copy(const char*, size_t, CHARSET_INFO*, CHARSET_INFO*, uint*)") at assert.c:92
      #7  0x000014b322e55412 in __GI___assert_fail (assertion=assertion@entry=0x563ecc376b71 "!str || str != Ptr", file=file@entry=0x563ecc376c60 "/test/10.5_dbg/sql/sql_string.cc", line=line@entry=430, function=function@entry=0x563ecc376fc0 <String::copy(char const*, unsigned long, charset_info_st const*, charset_info_st const*, unsigned int*)::__PRETTY_FUNCTION__> "bool String::copy(const char*, size_t, CHARSET_INFO*, CHARSET_INFO*, uint*)") at assert.c:101
      #8  0x0000563ecb7978ee in String::copy (this=this@entry=0x14b301474728, str=0x14b31a509f10 "`\241P\032\263\024", arg_length=0, from_cs=0x563ecced2e80 <my_charset_latin1>, to_cs=0x563eccef4dc0 <my_charset_utf16_general_ci>, errors=errors@entry=0x14b31a509ecc) at /test/10.5_dbg/sql/sql_string.cc:430
      #9  0x0000563ecba57d80 in Item_func::val_str_from_val_str_ascii (this=0x14b3014746f0, str=0x14b301474728, ascii_buffer=0x14b3014747b8) at /test/10.5_dbg/sql/item_strfunc.cc:111
      #10 0x0000563ecba04c0e in Item_str_ascii_func::val_str (this=<optimized out>, str=<optimized out>) at /test/10.5_dbg/sql/item_strfunc.h:88
      #11 0x0000563ecb9bb5a5 in Item::save_str_in_field (this=0x14b3014746f0, field=0x14b3014566a0, no_conversions=<optimized out>) at /test/10.5_dbg/sql/item.cc:6557
      #12 0x0000563ecb8afa4a 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.5_dbg/sql/sql_type.cc:4184
      #13 0x0000563ecb9a63b0 in Item::save_in_field (this=0x14b3014746f0, field=0x14b3014566a0, no_conversions=<optimized out>) at /test/10.5_dbg/sql/item.cc:6605
      #14 0x0000563ecb6870ff in Item_result_field::save_in_result_field (this=<optimized out>, no_conversions=<optimized out>) at /test/10.5_dbg/sql/item.h:3255
      #15 0x0000563ecb734cd6 in copy_funcs (func_ptr=0x14b301574420, thd=0x14b301415088) at /test/10.5_dbg/sql/sql_select.cc:25722
      #16 0x0000563ecb734d8a in end_write (join=0x14b301475870, join_tab=0x14b301476e60, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:22057
      #17 0x0000563ecb73a9bf in AGGR_OP::put_record (this=this@entry=0x14b3014776e0, end_of_records=end_of_records@entry=false) at /test/10.5_dbg/sql/sql_select.cc:28848
      #18 0x0000563ecb73b06e in AGGR_OP::put_record (this=0x14b3014776e0) at /test/10.5_dbg/sql/sql_select.h:1048
      #19 sub_select_postjoin_aggr (join=0x14b301475870, join_tab=0x14b301476e60, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:20345
      #20 0x0000563ecb71bb79 in evaluate_join_record (join=join@entry=0x14b301475870, join_tab=join_tab@entry=0x14b301476ab8, error=error@entry=0) at /test/10.5_dbg/sql/sql_select.cc:20852
      #21 0x0000563ecb722f35 in sub_select (join=0x14b301475870, join_tab=0x14b301476ab8, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:20629
      #22 0x0000563ecb75bd44 in do_select (procedure=0x0, join=0x14b301475870) at /test/10.5_dbg/sql/sql_select.cc:20163
      #23 JOIN::exec_inner (this=this@entry=0x14b301475870) at /test/10.5_dbg/sql/sql_select.cc:4475
      #24 0x0000563ecb75c35f in JOIN::exec (this=this@entry=0x14b301475870) at /test/10.5_dbg/sql/sql_select.cc:4256
      #25 0x0000563ecb75a674 in mysql_select (thd=thd@entry=0x14b301415088, tables=<optimized out>, fields=@0x14b301474288: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b301474810, last = 0x14b301474810, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=<optimized out>, group=0x0, having=0x0, proc_param=0x0, select_options=2147879680, result=0x14b301475848, unit=0x14b3014190a0, select_lex=0x14b301474138) at /test/10.5_dbg/sql/sql_select.cc:4680
      #26 0x0000563ecb75a9a3 in handle_select (thd=thd@entry=0x14b301415088, lex=lex@entry=0x14b301418fd8, result=result@entry=0x14b301475848, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
      #27 0x0000563ecb6e43a0 in execute_sqlcom_select (thd=thd@entry=0x14b301415088, all_tables=0x14b301474868) at /test/10.5_dbg/sql/sql_parse.cc:6208
      #28 0x0000563ecb6dd4cc in mysql_execute_command (thd=thd@entry=0x14b301415088) at /test/10.5_dbg/sql/sql_parse.cc:3939
      #29 0x0000563ecb6ea322 in mysql_parse (thd=thd@entry=0x14b301415088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14b31a50b350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7992
      #30 0x0000563ecb6d6e1c in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14b301415088, packet=packet@entry=0x14b301467089 "", packet_length=packet_length@entry=25, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1874
      #31 0x0000563ecb6d55f6 in do_command (thd=0x14b301415088) at /test/10.5_dbg/sql/sql_parse.cc:1355
      #32 0x0000563ecb8309f9 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14b304515808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
      #33 0x0000563ecb831115 in handle_one_connection (arg=arg@entry=0x14b304515808) at /test/10.5_dbg/sql/sql_connect.cc:1313
      #34 0x0000563ecbc90104 in pfs_spawn_thread (arg=0x14b321845888) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #35 0x000014b323b486db in start_thread (arg=0x14b31a50c700) at pthread_create.c:463
      #36 0x000014b322f4688f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.1.46 (dbg), 10.2.33 (dbg), 10.3.24 (dbg), 10.4.14 (dbg), 10.5.4 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.46 (opt), 10.2.33 (opt), 10.3.24 (opt), 10.4.14 (opt), 10.5.4 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (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.