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

Server crashes in Table_function_json_table::print upon SHOW FUNCTION CODE/SHOW CREATE VIEW, UBSAN: member access within null pointer

    XMLWordPrintable

Details

    Description

      CREATE FUNCTION f() RETURNS INT RETURN(SELECT c FROM JSON_TABLE('{}', '$' COLUMNS(c FOR ORDINALITY)) AS jt);
      SHOW FUNCTION CODE f;
       
      # Cleanup
      DROP FUNCTION f;
      

      10.6 71e1ddda

      #3  <signal handler called>
      #4  Table_function_json_table::print (this=0x7fcc900fa6a0, thd=0x7fcc90000db8, sql_table=0x7fcc900fb088, str=0x7fcca2b884a0, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF) at /data/src/10.6/sql/json_table.cc:1239
      #5  0x000055bfc8d8f0a7 in TABLE_LIST::print (this=0x7fcc900fb088, thd=0x7fcc90000db8, eliminated_tables=0, str=0x7fcca2b884a0, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF) at /data/src/10.6/sql/sql_select.cc:27976
      #6  0x000055bfc8d8e426 in print_table_array (thd=0x7fcc90000db8, eliminated_tables=0, str=0x7fcca2b884a0, table=0x7fcc90015a60, end=0x7fcc90015a68, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF) at /data/src/10.6/sql/sql_select.cc:27701
      #7  0x000055bfc8d8eb25 in print_join (thd=0x7fcc90000db8, eliminated_tables=0, str=0x7fcca2b884a0, tables=0x7fcc901a0eb8, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF) at /data/src/10.6/sql/sql_select.cc:27857
      #8  0x000055bfc8d8fb30 in st_select_lex::print (this=0x7fcc901a0d00, thd=0x7fcc90000db8, str=0x7fcca2b884a0, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF) at /data/src/10.6/sql/sql_select.cc:28164
      #9  0x000055bfc91766a6 in subselect_single_select_engine::print (this=0x7fcc901a1b48, str=0x7fcca2b884a0, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF) at /data/src/10.6/sql/item_subselect.cc:4609
      #10 0x000055bfc916899f in Item_subselect::print (this=0x7fcc901a19c0, str=0x7fcca2b884a0, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF) at /data/src/10.6/sql/item_subselect.cc:1114
      #11 0x000055bfc8bf96e6 in sp_instr_freturn::print (this=0x7fcc901a1b88, str=0x7fcca2b884a0) at /data/src/10.6/sql/sp_head.cc:4212
      #12 0x000055bfc8bf6f8c in sp_head::show_routine_code (this=0x7fcc9019fd40, thd=0x7fcc90000db8) at /data/src/10.6/sql/sp_head.cc:3393
      #13 0x000055bfc8cfd5a0 in mysql_execute_command (thd=0x7fcc90000db8) at /data/src/10.6/sql/sql_parse.cc:5757
      #14 0x000055bfc8d043ea in mysql_parse (thd=0x7fcc90000db8, rawbuf=0x7fcc900155b0 "SHOW FUNCTION CODE f", length=20, parser_state=0x7fcca2b89490) at /data/src/10.6/sql/sql_parse.cc:8019
      #15 0x000055bfc8cf084e in dispatch_command (command=COM_QUERY, thd=0x7fcc90000db8, packet=0x7fcc9000b869 "", packet_length=20, blocking=true) at /data/src/10.6/sql/sql_parse.cc:1897
      #16 0x000055bfc8cef1f3 in do_command (thd=0x7fcc90000db8, blocking=true) at /data/src/10.6/sql/sql_parse.cc:1406
      #17 0x000055bfc8eab8ca in do_handle_one_connection (connect=0x55bfcbe3fd08, put_in_cache=true) at /data/src/10.6/sql/sql_connect.cc:1410
      #18 0x000055bfc8eab626 in handle_one_connection (arg=0x55bfcbe3d068) at /data/src/10.6/sql/sql_connect.cc:1312
      #19 0x000055bfc9416ae7 in pfs_spawn_thread (arg=0x55bfcbe3f858) at /data/src/10.6/storage/perfschema/pfs.cc:2201
      #20 0x00007fcca8846609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #21 0x00007fcca841a293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      The test case is not applicable to non-debug build due to the use of SHOW FUNCTION CODE and to earlier versions due to the use of JSON_TABLE.

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.