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

SIGSEGV's in GetDefaultPrec and JSON::GetType on SELECT after loading ha_connect.so, and UBSAN: member call on null pointer in JVALUE::GetValType()

    XMLWordPrintable

Details

    Description

      CREATE FUNCTION json_array_add RETURNS STRING SONAME 'ha_connect.so';
      SELECT json_array_add('[5,3,8,7,9]' a,4,9);
      

      Leads to:

      11.5.0 e4afa610539ae01164485554e2de839bea9de816 (Debug)

      Core was generated by `/test/MD170524-mariadb-11.5.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x0000000000000000 in ?? ()
      [Current thread is 1 (LWP 1374315)]
      (gdb) bt
      #0  0x0000000000000000 in ?? ()
      #1  0x0000145c8c43378b in GetDefaultPrec ()at /test/11.5_dbg/storage/connect/ha_connect.cc:507
      #2  0x0000145c8c45bbd5 in Serialize (g=g@entry=0x145c60036350, jsp=jsp@entry=0x145c600388a8, fn=fn@entry=0x0, pretty=pretty@entry=0)at /test/11.5_dbg/storage/connect/json.cpp:269
      #3  0x0000145c8c4620b9 in MakeResult (g=g@entry=0x145c60036350, args=args@entry=0x145c6001b6c8, top=0x145c600388a8, n=3)at /test/11.5_dbg/storage/connect/jsonudf.cpp:1450
      #4  0x0000145c8c463bf9 in json_array_add (initid=<optimized out>, args=0x145c6001b6c8, result=<optimized out>, res_length=0x145c8c5a1d28, is_null=0x145c8c5a1d27 "", error=0x145c6001b738 "")at /test/11.5_dbg/storage/connect/jsonudf.cpp:2302
      #5  0x0000563bfff8bcd8 in udf_handler::val_str (this=this@entry=0x145c6001b6b8, str=str@entry=0x145c8c5a1e30, save_str=save_str@entry=0x145c6001b630)at /test/11.5_dbg/sql/sql_string.h:359
      #6  0x0000563bfff8be04 in Item_func_udf_str::val_str (this=0x145c6001b608, str=0x145c8c5a1e30) at /test/11.5_dbg/sql/item_func.cc:3838
      #7  0x0000563bffe2f84c in Type_handler::Item_send_str (this=<optimized out>, item=0x145c6001b608, protocol=0x145c60001370, buf=<optimized out>)at /test/11.5_dbg/sql/sql_type.cc:7501
      #8  0x0000563bffd47899 in Type_handler_string_result::Item_send (this=<optimized out>, item=<optimized out>, protocol=<optimized out>, buf=<optimized out>) at /test/11.5_dbg/sql/sql_type.h:5659
      #9  0x0000563bffab6642 in Item::send (this=0x145c6001b608, protocol=0x145c60001370, buffer=0x145c8c5a1e00)at /test/11.5_dbg/sql/item.h:1254
      #10 0x0000563bffaed671 in Protocol::send_result_set_row (this=this@entry=0x145c60001370, row_items=row_items@entry=0x145c6001b1c0)at /test/11.5_dbg/sql/protocol.cc:1359
      #11 0x0000563bffb6a759 in select_send::send_data (this=0x145c6001c0d8, items=@0x145c6001b1c0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x145c6001b780, last = 0x145c6001b780, elements = 1}, <No data fields>})at /test/11.5_dbg/sql/sql_class.cc:3189
      #12 0x0000563bffc7322e in select_result_sink::send_data_with_check (sent=0, u=<optimized out>, items=<optimized out>, this=<optimized out>)at /test/11.5_dbg/sql/sql_class.h:6090
      #13 JOIN::exec_inner (this=this@entry=0x145c6001c100)at /test/11.5_dbg/sql/sql_select.cc:4862
      #14 0x0000563bffc7408c in JOIN::exec (this=this@entry=0x145c6001c100)at /test/11.5_dbg/sql/sql_select.cc:4774
      #15 0x0000563bffc71e95 in mysql_select (thd=thd@entry=0x145c60000d58, tables=0x0, fields=@0x145c6001b1c0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x145c6001b780, last = 0x145c6001b780, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x145c6001c0d8, unit=0x145c600051f0, select_lex=0x145c6001af08) at /test/11.5_dbg/sql/sql_select.cc:5304
      #16 0x0000563bffc726be in handle_select (thd=thd@entry=0x145c60000d58, lex=lex@entry=0x145c60005110, result=result@entry=0x145c6001c0d8, setup_tables_done_option=setup_tables_done_option@entry=0)at /test/11.5_dbg/sql/sql_select.cc:630
      #17 0x0000563bffbd23c7 in execute_sqlcom_select (thd=thd@entry=0x145c60000d58, all_tables=0x0) at /test/11.5_dbg/sql/sql_parse.cc:6093
      #18 0x0000563bffbdd720 in mysql_execute_command (thd=thd@entry=0x145c60000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.5_dbg/sql/sql_parse.cc:3942
      #19 0x0000563bffbe40a5 in mysql_parse (thd=thd@entry=0x145c60000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x145c8c5a3230)at /test/11.5_dbg/sql/sql_parse.cc:7815
      #20 0x0000563bffbe6593 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x145c60000d58, packet=packet@entry=0x145c6000b1e9 "", packet_length=packet_length@entry=42, blocking=blocking@entry=true)at /test/11.5_dbg/sql/sql_class.h:254
      #21 0x0000563bffbe8861 in do_command (thd=0x145c60000d58, blocking=blocking@entry=true) at /test/11.5_dbg/sql/sql_parse.cc:1405
      #22 0x0000563bffd5d1ce in do_handle_one_connection (connect=<optimized out>, connect@entry=0x563c0358c8a8, put_in_cache=put_in_cache@entry=true)at /test/11.5_dbg/sql/sql_connect.cc:1445
      #23 0x0000563bffd5d4ce in handle_one_connection (arg=arg@entry=0x563c0358c8a8)at /test/11.5_dbg/sql/sql_connect.cc:1347
      #24 0x0000563c001a1980 in pfs_spawn_thread (arg=0x563c03542638)at /test/11.5_dbg/storage/perfschema/pfs.cc:2201
      #25 0x0000145cb0a97ada in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:444
      #26 0x0000145cb0b2847c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug confirmed present in:
      MariaDB: 10.5.26 (dbg), 10.5.26 (opt), 10.6.19 (dbg), 10.6.19 (opt), 10.11.9 (dbg), 10.11.9 (opt), 11.1.6 (dbg), 11.1.6 (opt), 11.2.5 (dbg), 11.2.5 (opt), 11.4.2 (dbg), 11.4.2 (opt), 11.5.0 (dbg), 11.5.0 (opt), 11.6.0 (dbg), 11.6.0 (opt)

      Attachments

        Activity

          People

            TheLinuxJedi Andrew Hutchings
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.