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

Assertion `ptr' failed in const uchar *skip_trailing_space(const uchar *, size_t)

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (1),(2),(3);
       
      DELIMITER $$;
      CREATE PROCEDURE p1()
      BEGIN
        DECLARE c CURSOR FOR SELECT * FROM t1 WHERE a = 1;
        OPEN c USING 1;
        CLOSE c;
      END;
      $$
      DELIMITER ;$$
       
      CALL p1;
       
      # Cleanup
      DROP PROCEDURE p1;
      DROP TABLE t1;
      

      Leads to:

      CS 13.1.0 fd8cec54af7a9d79749df25ea70dac695b371641 (Debug, Clang 18.1.3-11) Build 10/07/2026

      mariadbd: /test/13.1_dbg/strings/strings_def.h:85: const uchar *skip_trailing_space(const uchar *, size_t): Assertion `ptr' failed.
      

      CS 13.1.0 fd8cec54af7a9d79749df25ea70dac695b371641 (Debug, Clang 18.1.3-11) Build 10/07/2026

      Core was generated by `/test/MD100726-mariadb-13.1.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --loo'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 219252)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x000076e648a4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000076e648a288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000076e648a2881b in __assert_fail_base (fmt=0x76e648bd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x60b9773f3dd4 "ptr", file=file@entry=0x60b9775c705d "/test/13.1_dbg/strings/strings_def.h", line=line@entry=85, function=function@entry=0x60b9775c70be "const uchar *skip_trailing_space(const uchar *, size_t)") at ./assert/assert.c:96
      #6  0x000076e648a3b517 in __assert_fail (assertion=0x60b9773f3dd4 "ptr", file=0x60b9775c705d "/test/13.1_dbg/strings/strings_def.h", line=85, function=0x60b9775c70be "const uchar *skip_trailing_space(const uchar *, size_t)") at ./assert/assert.c:105
      #7  0x000060b97710283b in skip_trailing_space (ptr=0x0, len=0)at /test/13.1_dbg/strings/strings_def.h:85
      #8  0x000060b977104225 in my_hash_sort_utf8mb3_general1400_as_ci (hasher=0x76e6443410f8, cs=0x60b97807b670 <my_charset_utf8mb3_general1400_as_ci>, s=0x0, slen=0)at /test/13.1_dbg/strings/ctype-utf8.c:584
      #9  0x000060b977050d49 in my_ci_hash_sort (hasher=0x76e6443410f8, ci=0x60b97807b670 <my_charset_utf8mb3_general1400_as_ci>, key=0x0, len=0)at /test/13.1_dbg/include/m_ctype.h:1536
      #10 0x000060b977050d02 in my_hash_sort (cs=0x60b97807b670 <my_charset_utf8mb3_general1400_as_ci>, key=0x0, length=0) at /test/13.1_dbg/mysys/hash.c:48
      #11 0x000060b9770510c1 in my_hash_first (hash=0x6ee530003090, key=0x0, length=0, current_record=0x76e6443411c4) at /test/13.1_dbg/mysys/hash.c:264
      #12 0x000060b977050fb9 in my_hash_search (hash=0x6ee530003090, key=0x0, length=0) at /test/13.1_dbg/mysys/hash.c:236
      #13 0x000060b9762bbd7f in Statement_map::find_by_name (this=0x6ee530003010, name=0x6ee5300817f0) at /test/13.1_dbg/sql/sql_class.h:2026
      #14 0x000060b9762bbfa8 in Prepared_statement::find_by_name_or_error (thd=0x6ee530000d60, name=@0x6ee5300817f0: {str = 0x0, length = 0}, clause=0x60b9773c3808 "OPEN") at /test/13.1_dbg/sql/sql_prepare.cc:253
      #15 0x000060b9762ae3eb in mysql_sql_stmt_set_placeholder (thd=0x6ee530000d60, ps_name=@0x6ee5300817f0: {<Lex_ident_sys_st> = {<st_mysql_const_lex_string> = {str = 0x0, length = 0}, <Sql_alloc> = {<No data fields>}, <No data fields>}, <No data fields>}, using_param_offset=0, item_expr=0x6ee530082cc0)at /test/13.1_dbg/sql/sql_prepare.cc:3048
      #16 0x000060b97654060c in sp_instr_set_ps_placeholder::exec_core (this=0x6ee530082d80, thd=0x6ee530000d60, nextp=0x76e6443417c8)at /test/13.1_dbg/sql/sp_instr.cc:1426
      #17 0x000060b97653d4a6 in sp_lex_keeper::reset_lex_and_exec_core (this=0x6ee530082dc0, thd=0x6ee530000d60, nextp=0x76e6443417c8, open_tables=true, instr=0x6ee530082d80, rerun_the_same_instr=false)at /test/13.1_dbg/sql/sp_instr.cc:420
      #18 0x000060b97653dc1c in sp_lex_keeper::validate_lex_and_exec_core (this=0x6ee530082dc0, thd=0x6ee530000d60, nextp=0x76e6443417c8, open_tables=true, instr=0x6ee530082d80)at /test/13.1_dbg/sql/sp_instr.cc:599
      #19 0x000060b97654027e in sp_instr_set_ps_placeholder::execute (this=0x6ee530082d80, thd=0x6ee530000d60, nextp=0x76e6443417c8)at /test/13.1_dbg/sql/sp_instr.cc:1362
      #20 0x000060b97613cd6c in sp_head::execute (this=0x6ee53007d8c0, thd=0x6ee530000d60, merge_da_on_success=true)at /test/13.1_dbg/sql/sp_head.cc:1332
      #21 0x000060b97613f76e in sp_head::execute_procedure (this=0x6ee53007d8c0, thd=0x6ee530000d60, args=0x6ee530006280)at /test/13.1_dbg/sql/sp_head.cc:2369
      #22 0x000060b97626a2f7 in do_execute_sp (thd=0x6ee530000d60, sp=0x6ee53007d8c0)at /test/13.1_dbg/sql/sql_parse.cc:3084
      #23 0x000060b976269e18 in Sql_cmd_call::execute (this=0x6ee53001a680, thd=0x6ee530000d60) at /test/13.1_dbg/sql/sql_parse.cc:3322
      #24 0x000060b976276248 in mysql_execute_command (thd=0x6ee530000d60, is_called_from_prepared_stmt=false) at /test/13.1_dbg/sql/sql_parse.cc:5905
      #25 0x000060b9762653c4 in mysql_parse (thd=0x6ee530000d60, rawbuf=0x6ee53001a3e0 "CALL p1", length=7, parser_state=0x76e644343ab0)at /test/13.1_dbg/sql/sql_parse.cc:7945
      #26 0x000060b97626270d in dispatch_command (command=COM_QUERY, thd=0x6ee530000d60, packet=0x6ee53000b611 "CALL p1", packet_length=7, blocking=true) at /test/13.1_dbg/sql/sql_parse.cc:1903
      #27 0x000060b976265f73 in do_command (thd=0x6ee530000d60, blocking=true)at /test/13.1_dbg/sql/sql_parse.cc:1437
      #28 0x000060b9764646a9 in do_handle_one_connection (connect=0x60b979b7ff70, put_in_cache=true) at /test/13.1_dbg/sql/sql_connect.cc:1510
      #29 0x000060b97646444e in handle_one_connection (arg=0x60b979b66070)at /test/13.1_dbg/sql/sql_connect.cc:1422
      #30 0x000076e648a9caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #31 0x000076e648b29c6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed
      CS  10.11  dbg  100726  0617cf2ab5fc37f49b25c22524c909f26069bd44  No bug found
      CS  10.11  opt  100726  0617cf2ab5fc37f49b25c22524c909f26069bd44  No bug found
      CS  11.4   dbg  100726  1fff140f0c25f6a5b2f6fd0b5ef6b6c50d60e913  No bug found
      CS  11.4   opt  100726  1fff140f0c25f6a5b2f6fd0b5ef6b6c50d60e913  No bug found
      CS  11.8   dbg  100726  666b2aca09cb84d59b4ece2185a9200d745cb287  No bug found
      CS  11.8   opt  100726  666b2aca09cb84d59b4ece2185a9200d745cb287  No bug found
      CS  12.3   dbg  100726  27df5668c2e3eef406a5357672d3d8e89d25ff48  ptr|SIGABRT|skip_trailing_space|my_hash_sort_utf8mb3_general1400_as_ci|my_ci_hash_sort|my_hash_sort
      CS  12.3   opt  100726  27df5668c2e3eef406a5357672d3d8e89d25ff48  No bug found
      CS  13.0   dbg  100726  84c246ca5387c0611f75097136ff4f4bea092aa3  ptr|SIGABRT|skip_trailing_space|my_hash_sort_utf8mb3_general1400_as_ci|my_ci_hash_sort|my_hash_sort
      CS  13.0   opt  100726  84c246ca5387c0611f75097136ff4f4bea092aa3  No bug found
      CS  13.1   dbg  100726  fd8cec54af7a9d79749df25ea70dac695b371641  ptr|SIGABRT|skip_trailing_space|my_hash_sort_utf8mb3_general1400_as_ci|my_ci_hash_sort|my_hash_sort
      CS  13.1   opt  100726  fd8cec54af7a9d79749df25ea70dac695b371641  No bug found
      ES  11.4   dbg  060526  90f707057d44f1b5c013a0c3672fd12f32ea7085  No bug found
      ES  11.4   opt  060526  90f707057d44f1b5c013a0c3672fd12f32ea7085  No bug found
      ES  11.8   dbg  060526  1499789de285a8109d68d79347de0281865b28f4  No bug found
      ES  11.8   opt  060526  1499789de285a8109d68d79347de0281865b28f4  No bug found
      

      Attachments

        Activity

          People

            bar Alexander Barkov
            ramesh Ramesh Sivaraman
            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 - 0.5h
                0.5h

                Git Integration

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