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

Assertion field_max_length <= m_return_field_def.length || m_return_field_def.type_handler()->cmp_type() == INT_RESULT || (_current_thd()->stmt_arena->is_stmt_execute() && m_return_field_def.length == 8 && (m_return_field_def.pack_flag & (1024U|2048U)))

    XMLWordPrintable

Details

    Description

      USE test;
      CREATE FUNCTION f(c INT) RETURNS BLOB RETURN 0;
      CREATE PROCEDURE p(IN c INT) SELECT f('a');
      --error 1366
      CALL p(0);
      CALL p(0);
      

      Leads to:

      10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

      mysqld: /test/10.5_dbg/sql/sp_head.cc:977: Field* sp_head::create_result_field(uint, const LEX_CSTRING*, TABLE*) const: Assertion `field_max_length <= m_return_field_def.length || m_return_field_def.type_handler()->cmp_type() == INT_RESULT || (_current_thd()->stmt_arena->is_stmt_execute() && m_return_field_def.length == 8 && (m_return_field_def.pack_flag & (1024U|2048U)))' failed.
      

      10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

      Core was generated by `/test/MD210420-mariadb-10.5.3-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 0x7fd6cfdc3700 (LWP 1206450))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x0000564bfbefa03d in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
      #2  0x0000564bfb69fd7b in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:329
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x00007fd6ce507801 in __GI_abort () at abort.c:79
      #6  0x00007fd6ce4f739a in __assert_fail_base (fmt=0x7fd6ce67e7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x564bfc054618 "field_max_length <= m_return_field_def.length || m_return_field_def.type_handler()->cmp_type() == INT_RESULT || (_current_thd()->stmt_arena->is_stmt_execute() && m_return_field_def.length == 8 && (m_r"..., file=file@entry=0x564bfc053abe "/test/10.5_dbg/sql/sp_head.cc", line=line@entry=977, function=function@entry=0x564bfc055ec0 <sp_head::create_result_field(unsigned int, st_mysql_const_lex_string const*, TABLE*) const::__PRETTY_FUNCTION__> "Field* sp_head::create_result_field(uint, const LEX_CSTRING*, TABLE*) const") at assert.c:92
      #7  0x00007fd6ce4f7412 in __GI___assert_fail (assertion=assertion@entry=0x564bfc054618 "field_max_length <= m_return_field_def.length || m_return_field_def.type_handler()->cmp_type() == INT_RESULT || (_current_thd()->stmt_arena->is_stmt_execute() && m_return_field_def.length == 8 && (m_r"..., file=file@entry=0x564bfc053abe "/test/10.5_dbg/sql/sp_head.cc", line=line@entry=977, function=function@entry=0x564bfc055ec0 <sp_head::create_result_field(unsigned int, st_mysql_const_lex_string const*, TABLE*) const::__PRETTY_FUNCTION__> "Field* sp_head::create_result_field(uint, const LEX_CSTRING*, TABLE*) const") at assert.c:101
      #8  0x0000564bfb32d86a in sp_head::create_result_field (this=0x7fd6a24fe0a0, field_max_length=field_max_length@entry=65535, field_name=field_name@entry=0x7fd6a24f15c8, table=0x7fd6a24890a0) at /test/10.5_dbg/sql/sp_head.cc:972
      #9  0x0000564bfb6cd8fc in Item_sp::init_result_field (this=this@entry=0x7fd6a24f1638, thd=thd@entry=0x7fd6a2415088, max_length=65535, maybe_null=1, null_value=null_value@entry=0x7fd6a24f15ee, name=name@entry=0x7fd6a24f15c8) at /test/10.5_dbg/sql/item.cc:2846
      #10 0x0000564bfb7356ed in Item_func_sp::fix_fields (this=0x7fd6a24f1570, thd=0x7fd6a2415088, ref=0x7fd6a24f1700) at /test/10.5_dbg/sql/item_func.cc:6494
      #11 0x0000564bfb37a4a3 in Item::fix_fields_if_needed (ref=0x7fd6a24f1700, thd=0x7fd6a2415088, this=0x7fd6a24f1570) at /test/10.5_dbg/sql/item.h:976
      #12 Item::fix_fields_if_needed_for_scalar (ref=0x7fd6a24f1700, thd=0x7fd6a2415088, this=0x7fd6a24f1570) at /test/10.5_dbg/sql/item.h:980
      #13 setup_fields (thd=0x7fd6a2415088, ref_pointer_array=..., fields=..., column_usage=column_usage@entry=MARK_COLUMNS_READ, sum_func_list=sum_func_list@entry=0x7fd6a24fb518, pre_fix=0x7fd6a24f0f88, allow_sum_func=true) at /test/10.5_dbg/sql/sql_base.cc:7516
      #14 0x0000564bfb464ddf in JOIN::prepare (this=this@entry=0x7fd6a24fb1f0, tables_init=tables_init@entry=0x0, conds_init=conds_init@entry=0x0, og_num=og_num@entry=0, order_init=order_init@entry=0x0, skip_order_by=skip_order_by@entry=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fd6a24f0e20, unit_arg=0x7fd6a247d168) at /test/10.5_dbg/sql/sql_select.cc:1241
      #15 0x0000564bfb472385 in mysql_select (thd=thd@entry=0x7fd6a2415088, tables=0x0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147749632, result=0x7fd6a24fb1c8, unit=0x7fd6a247d168, select_lex=0x7fd6a24f0e20) at /test/10.5_dbg/sql/sql_select.cc:4634
      #16 0x0000564bfb472787 in handle_select (thd=thd@entry=0x7fd6a2415088, lex=lex@entry=0x7fd6a247d0a0, result=result@entry=0x7fd6a24fb1c8, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
      #17 0x0000564bfb3fcef4 in execute_sqlcom_select (thd=thd@entry=0x7fd6a2415088, all_tables=0x0) at /test/10.5_dbg/sql/sql_parse.cc:6172
      #18 0x0000564bfb3f5919 in mysql_execute_command (thd=0x7fd6a2415088) at /test/10.5_dbg/sql/sql_parse.cc:3901
      #19 0x0000564bfb328da5 in sp_instr_stmt::exec_core (this=0x7fd6a24f1f30, thd=<optimized out>, nextp=0x7fd6cfdc0fa4) at /test/10.5_dbg/sql/sp_head.cc:3761
      #20 0x0000564bfb334969 in sp_lex_keeper::reset_lex_and_exec_core (this=this@entry=0x7fd6a24f1f78, thd=thd@entry=0x7fd6a2415088, nextp=nextp@entry=0x7fd6cfdc0fa4, open_tables=open_tables@entry=false, instr=instr@entry=0x7fd6a24f1f30) at /test/10.5_dbg/sql/sp_head.cc:3488
      #21 0x0000564bfb33550b in sp_instr_stmt::execute (this=0x7fd6a24f1f30, thd=0x7fd6a2415088, nextp=0x7fd6cfdc0fa4) at /test/10.5_dbg/sql/sp_head.cc:3667
      #22 0x0000564bfb32e41a in sp_head::execute (this=this@entry=0x7fd6a24f00a0, thd=thd@entry=0x7fd6a2415088, merge_da_on_success=merge_da_on_success@entry=true) at /test/10.5_dbg/sql/sp_head.cc:1432
      #23 0x0000564bfb33025e in sp_head::execute_procedure (this=0x7fd6a24f00a0, thd=thd@entry=0x7fd6a2415088, args=0x7fd6a2419f60) at /test/10.5_dbg/sql/sp_head.cc:2442
      #24 0x0000564bfb3f30ca in do_execute_sp (thd=thd@entry=0x7fd6a2415088, sp=sp@entry=0x7fd6a24f00a0) at /test/10.5_dbg/sql/sql_parse.cc:3013
      #25 0x0000564bfb3f3b4e in Sql_cmd_call::execute (this=0x7fd6a2474150, thd=0x7fd6a2415088) at /test/10.5_dbg/sql/sql_parse.cc:3258
      #26 0x0000564bfb3fb422 in mysql_execute_command (thd=thd@entry=0x7fd6a2415088) at /test/10.5_dbg/sql/sql_parse.cc:5912
      #27 0x0000564bfb402f2b in mysql_parse (thd=thd@entry=0x7fd6a2415088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fd6cfdc2450, 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:7957
      #28 0x0000564bfb3eec45 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fd6a2415088, packet=packet@entry=0x7fd6a2467089 "CALL p(0)", packet_length=packet_length@entry=9, 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:1839
      #29 0x0000564bfb3ed49b in do_command (thd=0x7fd6a2415088) at /test/10.5_dbg/sql/sql_parse.cc:1358
      #30 0x0000564bfb548415 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7fd6adfc53a8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1422
      #31 0x0000564bfb548744 in handle_one_connection (arg=arg@entry=0x7fd6adfc53a8) at /test/10.5_dbg/sql/sql_connect.cc:1319
      #32 0x0000564bfb9a8fb0 in pfs_spawn_thread (arg=0x7fd6cd845b08) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #33 0x00007fd6cf1ea6db in start_thread (arg=0x7fd6cfdc3700) at pthread_create.c:463
      #34 0x00007fd6ce5e888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.3.23 (dbg), 10.4.13 (dbg), 10.5.2 (dbg), 10.5.3 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (opt), 10.4.13 (opt), 10.5.2 (opt), 10.5.3 (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

              sanja Oleksandr Byelkin
              Roel Roel Van de Paar
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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