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

SIGSEGV in Item_sp_variable::save_in_field | fill_record

    XMLWordPrintable

Details

    • Not for Release Notes
    • Q3/2025 Maintenance

    Description

      CREATE TABLE t1 (a INT);
      SET character_set_database=sjis;
      SET collation_connection=ucs2_general_ci;
      SET sql_mode=ORACLE;
      --delimiter $$
      DECLARE
        TYPE first_names_t IS TABLE OF VARCHAR2(64) INDEX BY VARCHAR2(20);
        first_names first_names_t;
        nick VARCHAR(64):= 'Monty';
      BEGIN
        first_names('Monty') := 'Michael';
        INSERT INTO t1 VALUES (first_names(nick));
        INSERT INTO t1 VALUES (first_names(TRIM(nick || ' ')));
      END;
      $$
      --delimiter ;
       
      #clean up
      DROP TABLE t1;
      

      Leads to

      MDEV-34319 CS 12.0.1 6f01debfe6ed37f85508c722bf4ae87af2288205 (Optimized) Build 20/05/2025

      Core was generated by `/test/mtest/MDEV-34319/MD200525-mariadb-12.0.1-linux-x86_64-opt/bin/mariadbd --'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x00005a1a9ae821c5 in Item_sp_variable::save_in_field (this=<optimized out>, field=0x737c0003e098, no_conversions=false)at /test/mtest/MDEV-34319/12.0_opt/sql/item.h:3206
       
      [Current thread is 1 (LWP 1686799)]
      (gdb) bt
      #0  0x00005a1a9ae821c5 in Item_sp_variable::save_in_field (this=<optimized out>, field=0x737c0003e098, no_conversions=false)at /test/mtest/MDEV-34319/12.0_opt/sql/item.h:3206
      #1  0x00005a1a9ae24df7 in fill_record (thd=thd@entry=0x737c00000c68, table=0x737c000248b8, ptr=0x737c0003e090, values=@0x737c0002f798: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x737c00037920, last = 0x737c00037920, elements = 1}, <No data fields>}, ignore_errors=false, use_value=false, check_for_computability=<optimized out>)at /test/mtest/MDEV-34319/12.0_opt/sql/sql_base.cc:9402
      #2  0x00005a1a9ae24f60 in fill_record_n_invoke_before_triggers (thd=0x0, thd@entry=0x737c00000c68, table=0x737c0006a950, ptr=0x737c0006a, values=<error reading variable: Cannot access memory at address 0x7f4339aaa17ed600>, ignore_errors=224, event=event@entry=TRG_EVENT_INSERT, skip_row_indicator=0x739adc4b4720)at /test/mtest/MDEV-34319/12.0_opt/sql/sql_base.cc:9461
      #3  0x00005a1a9ae5543a in mysql_insert (thd=thd@entry=0x737c00000c68, table_list=0x737c00032a20, fields=@0x737c00036878: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5a1a9c11a0d8 <end_of_list>, last = 0x737c00036878, elements = 0}, <No data fields>}, values_list=@0x737c000368c0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x737c00037930, last = 0x737c00037930, elements = 1}, <No data fields>}, update_fields=@0x737c000368a8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5a1a9c11a0d8 <end_of_list>, last = 0x737c000368a8, elements = 0}, <No data fields>}, update_values=@0x737c00036890: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5a1a9c11a0d8 <end_of_list>, last = 0x737c00036890, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=<optimized out>, result=0x0)at /test/mtest/MDEV-34319/12.0_opt/sql/sql_insert.cc:1120
      #4  0x00005a1a9ae91465 in mysql_execute_command (thd=0x737c00000c68, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-34319/12.0_opt/sql/sql_parse.cc:4459
      #5  0x00005a1a9b039667 in sp_instr_stmt::exec_core (this=0x737c00038248, thd=0x0, nextp=0x737c0006a)at /test/mtest/MDEV-34319/12.0_opt/sql/sp_instr.cc:1136
      #6  0x00005a1a9b037b8f in sp_lex_keeper::reset_lex_and_exec_core (this=this@entry=0x737c00038280, thd=thd@entry=0x737c00000c68, nextp=nextp@entry=0x739adc4b5584, open_tables=false, instr=instr@entry=0x737c00038248, rerun_the_same_instr=<optimized out>)at /test/mtest/MDEV-34319/12.0_opt/sql/sp_instr.cc:356
      #7  0x00005a1a9b03819b in sp_lex_keeper::validate_lex_and_exec_core (this=this@entry=0x737c00038280, thd=thd@entry=0x737c00000c68, nextp=nextp@entry=0x739adc4b5584, open_tables=<optimized out>, instr=instr@entry=0x737c00038248)at /test/mtest/MDEV-34319/12.0_opt/sql/sp_instr.cc:535
      #8  0x00005a1a9b03909a in sp_instr_stmt::execute (this=0x737c00038248, thd=0x737c00000c68, nextp=0x739adc4b5584)at /test/mtest/MDEV-34319/12.0_opt/sql/sp_instr.cc:1038
      #9  0x00005a1a9ade4a8a in sp_head::execute (this=this@entry=0x737c00021820, thd=thd@entry=0x737c00000c68, merge_da_on_success=true)at /test/mtest/MDEV-34319/12.0_opt/sql/sp_head.cc:1295
      #10 0x00005a1a9ade6523 in sp_head::execute_procedure (this=0x737c00021820, thd=0x737c00000c68, args=0x737c00006020)at /test/mtest/MDEV-34319/12.0_opt/sql/sp_head.cc:2329
      #11 0x00005a1a9ae8d9ba in do_execute_sp (thd=thd@entry=0x737c00000c68, sp=0x0)at /test/mtest/MDEV-34319/12.0_opt/sql/sql_parse.cc:3060
      #12 0x00005a1a9ae8fe74 in mysql_execute_command (thd=thd@entry=0x737c00000c68, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-34319/12.0_opt/sql/sql_parse.cc:5593
      #13 0x00005a1a9ae8a591 in mysql_parse (thd=thd@entry=0x737c00000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x739adc4b6420)at /test/mtest/MDEV-34319/12.0_opt/sql/sql_parse.cc:7891
      #14 0x00005a1a9ae88aaf in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x737c00000c68, packet=packet@entry=0x737c00008a59 "DECLARE\n  TYPE first_names_t IS TABLE OF VARCHAR2(64) INDEX BY VARCHAR2(20);\n  first_names first_names_t;\n  nick VARCHAR(64):= 'Monty';\nBEGIN\n  first_names('Monty') := 'Michael';\n  INSERT INTO t1 VALU"..., packet_length=packet_length@entry=286, blocking=true)at /test/mtest/MDEV-34319/12.0_opt/sql/sql_parse.cc:1877
      #15 0x00005a1a9ae8a9a1 in do_command (thd=thd@entry=0x737c00000c68, blocking=true) at /test/mtest/MDEV-34319/12.0_opt/sql/sql_parse.cc:1416
      #16 0x00005a1a9afb761d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5a1aada4cda8, put_in_cache=true)at /test/mtest/MDEV-34319/12.0_opt/sql/sql_connect.cc:1414
      #17 0x00005a1a9afb73df in handle_one_connection (arg=arg@entry=0x5a1aada4cda8)at /test/mtest/MDEV-34319/12.0_opt/sql/sql_connect.cc:1326
      #18 0x00005a1a9b35d7a9 in pfs_spawn_thread (arg=0x5a1aad9ec3e8)at /test/mtest/MDEV-34319/12.0_opt/storage/perfschema/pfs.cc:2198
      #19 0x0000739ae449caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #20 0x0000739ae4529c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              6 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.