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

SIGSEGV in Dynamic_array<sp_type_def*>::elements

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      CREATE PACKAGE p PROCEDURE q (a INT DEFAULT b());
      

      Leads to:

      CS 12.3.3 8436fe3f48173914b81f43ff0759ec493c06e767 (Optimized, Clang 22.1.8-20260622) Build 29/07/2026

      Core was generated by `/test/MD290726-mariadb-12.3.3-linux-x86_64-opt/bin/mariadbd --no-defaults --loo'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  sp_type_def_list::find_type_def (this=0x0, name=...)at /test/12.3_opt/sql/sp_type_def.h:103
       
      [Current thread is 1 (LWP 918109)]
      (gdb) bt
      #0  sp_type_def_list::find_type_def (this=0x0, name=@0x7420a550a2c0: {str = 0x6c1f70026b80 "b", length = 1})at /test/12.3_opt/sql/sp_type_def.h:103
      #1  sp_pcontext::find_type_def (this=0x0, name=<optimized out>, current_scope_only=<optimized out>)at /test/12.3_opt/sql/sp_pcontext.cc:438
      #2  0x00005d81df12061f in MYSQLparse (thd=thd@entry=0x6c1f70000c70)at /test/12.3_opt/sql/sql_yacc.yy:11314
      #3  0x00005d81def12e65 in parse_sql (thd=thd@entry=0x6c1f70000c70, parser_state=parser_state@entry=0x7420a550a4f0, creation_ctx=creation_ctx@entry=0x0, do_pfs_digest=true)at /test/12.3_opt/sql/sql_parse.cc:10374
      #4  0x00005d81def06b21 in mysql_parse (thd=thd@entry=0x6c1f70000c70, rawbuf=0x6c1f70017cf0 "CREATE PACKAGE p PROCEDURE q (a INT DEFAULT b())", length=<optimized out>, parser_state=parser_state@entry=0x7420a550a4f0)at /test/12.3_opt/sql/sql_parse.cc:7899
      #5  0x00005d81def053ef in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x6c1f70000c70, packet=packet@entry=0x6c1f70008d81 "CREATE PACKAGE p PROCEDURE q (a INT DEFAULT b())", packet_length=packet_length@entry=48, blocking=true)at /test/12.3_opt/sql/sql_parse.cc:1903
      #6  0x00005d81def070a0 in do_command (thd=thd@entry=0x6c1f70000c70, blocking=true) at /test/12.3_opt/sql/sql_parse.cc:1437
      #7  0x00005d81df02e38d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5d81e1ebd920, put_in_cache=true)at /test/12.3_opt/sql/sql_connect.cc:1510
      #8  0x00005d81df02e1c2 in handle_one_connection (arg=arg@entry=0x5d81e1ebd920)at /test/12.3_opt/sql/sql_connect.cc:1422
      #9  0x00005d81df3ce523 in pfs_spawn_thread (arg=0x5d81e1ede040)at /test/12.3_opt/storage/perfschema/pfs.cc:2198
      #10 0x00007420a869cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #11 0x00007420a8729d6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      CS 12.3.3 8436fe3f48173914b81f43ff0759ec493c06e767 (Debug, Clang 22.1.8-20260622) Build 29/07/2026

      Core was generated by `/test/MD290726-mariadb-12.3.3-linux-x86_64-dbg/bin/mariadbd --no-defaults --loo'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  Dynamic_array<sp_type_def*>::elements (this=0x0)at /test/12.3_dbg/sql/sql_array.h:250
       
      [Current thread is 1 (LWP 919566)]
      (gdb) bt
      #0  Dynamic_array<sp_type_def*>::elements (this=0x0)at /test/12.3_dbg/sql/sql_array.h:250
      #1  0x0000645ca8acfc6f in sp_type_def_list::find_type_def (this=0x0, name=@0x7967d0802290: {str = 0x7166e00293f0 "b", length = 1})at /test/12.3_dbg/sql/sp_type_def.h:103
      #2  0x0000645ca8ace748 in sp_pcontext::find_type_def (this=0x0, name=@0x7967d0802290: {str = 0x7166e00293f0 "b", length = 1}, current_scope_only=true) at /test/12.3_dbg/sql/sp_pcontext.cc:438
      #3  0x0000645ca8b91994 in LEX::find_type_def (this=0x7166e002a6e0, name=@0x7967d0802290: {str = 0x7166e00293f0 "b", length = 1})at /test/12.3_dbg/sql/sql_lex.cc:6901
      #4  0x0000645ca8f14edd in MYSQLparse (thd=0x7166e0000d60)at /test/12.3_dbg/sql/sql_yacc.yy:11314
      #5  0x0000645ca8bdf3b8 in parse_sql (thd=0x7166e0000d60, parser_state=0x7967d08059f0, creation_ctx=0x0, do_pfs_digest=true)at /test/12.3_dbg/sql/sql_parse.cc:10374
      #6  0x0000645ca8bca262 in mysql_parse (thd=0x7166e0000d60, rawbuf=0x7166e001a570 "CREATE PACKAGE p PROCEDURE q (a INT DEFAULT b())", length=48, parser_state=0x7967d08059f0)at /test/12.3_dbg/sql/sql_parse.cc:7899
      #7  0x0000645ca8bc7b0e in dispatch_command (command=COM_QUERY, thd=0x7166e0000d60, packet=0x7166e000b5e1 "CREATE PACKAGE p PROCEDURE q (a INT DEFAULT b())", packet_length=48, blocking=true) at /test/12.3_dbg/sql/sql_parse.cc:1903
      #8  0x0000645ca8bcae3a in do_command (thd=0x7166e0000d60, blocking=true)at /test/12.3_dbg/sql/sql_parse.cc:1437
      #9  0x0000645ca8d9aa1e in do_handle_one_connection (connect=0x645caeb14db0, put_in_cache=true) at /test/12.3_dbg/sql/sql_connect.cc:1510
      #10 0x0000645ca8d9a801 in handle_one_connection (arg=0x645caebfe1b0)at /test/12.3_dbg/sql/sql_connect.cc:1422
      #11 0x00007967f809cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #12 0x00007967f8129d6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  290726  67ea07dd3400004e4f7ae01bf977f4344bbe064b  No bug found                  
      CS  10.6   opt  290726  67ea07dd3400004e4f7ae01bf977f4344bbe064b  No bug found                  
      CS  10.11  dbg  290726  41cdc5630eb53e0e184cb685202c1ad7a69bb6a6  No bug found                  
      CS  10.11  opt  290726  41cdc5630eb53e0e184cb685202c1ad7a69bb6a6  No bug found                  
      CS  11.4   dbg  290726  eccf9ca5f15bdca5b8e887396d9a570d580eb4ee  No bug found                  
      CS  11.4   opt  290726  eccf9ca5f15bdca5b8e887396d9a570d580eb4ee  No bug found                  
      CS  11.8   dbg  290726  1d23deff797ab448f091e39756434903d81a98c2  pkg|SIGABRT|is_package_public_routine_quick|Sp_handler::sp_resolve_package_routine_implicit|Sp_handler::sp_resolve_package_routine|Create_sp_func::create_with_db
      CS  11.8   opt  290726  1d23deff797ab448f091e39756434903d81a98c2  No bug found                  
      CS  12.3   dbg  290726  8436fe3f48173914b81f43ff0759ec493c06e767  SIGSEGV|Dynamic_array<sp_type_def*>::elements|sp_type_def_list::find_type_def|sp_pcontext::find_type_def|LEX::find_type_def
      CS  12.3   opt  290726  8436fe3f48173914b81f43ff0759ec493c06e767  SIGSEGV|sp_type_def_list::find_type_def|sp_pcontext::find_type_def|MYSQLparse|parse_sql
      CS  13.0   dbg  290726  84c246ca5387c0611f75097136ff4f4bea092aa3  pkg|SIGABRT|is_package_public_routine_quick|Sp_handler::sp_resolve_package_routine_implicit|Sql_path::resolve|Create_sp_func::create_with_db
      CS  13.0   opt  290726  84c246ca5387c0611f75097136ff4f4bea092aa3  No bug found                  
      CS  13.1   dbg  290726  cded2b25e65853a75c2213cfe0832819832708bd  pkg|SIGABRT|is_package_public_routine_quick|Sp_handler::sp_resolve_package_routine_implicit|Sql_path::resolve|Create_sp_func::create_with_db
      CS  13.1   opt  290726  cded2b25e65853a75c2213cfe0832819832708bd  No bug found                  
      ES  10.6   dbg  290726  fcecb2620f25965723d640decede7c018bcb1dcc  No bug found                  
      ES  11.4   dbg  290726  3b34189bfe675c18c4ced3ef531d016ea74c76f4  No bug found                  
      ES  11.8   dbg  290726  4694e931d10fecf733c34f83ea2146d31b708eb3  SIGSEGV|Dynamic_array<sp_type_def*>::elements|sp_type_def_list::find_type_def|sp_pcontext::find_type_def|LEX::find_type_def
      ES  12.3   dbg  290726  c1ba9a81dd4f6cdb34ca2cfe1c68ca0d68da2fca  SIGSEGV|Dynamic_array<sp_type_def*>::elements|sp_type_def_list::find_type_def|sp_pcontext::find_type_def|LEX::find_type_def
      

      Attachments

        Activity

          People

            bar Alexander Barkov
            saahil Saahil Alam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 1.5h
                1.5h

                Git Integration

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