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

Associative array INDEX BY BIGINT key -9223372036854775808 crashes the server

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 13.2
    • 13.2
    • PL/SQL
    • Can result in hang or crash

    Description

      Associative array INDEX BY BIGINT key -9223372036854775808 is rejected, or accepted and then crashes the server (13.2 debug build)

      SET GLOBAL general_log=1;
      SET sql_mode=ORACLE;
      DELIMITER $$
      DECLARE
        TYPE t IS TABLE OF INT INDEX BY BIGINT;
        a t;
        k BIGINT := -9223372036854775808;
      BEGIN
        a(k) := 1;
        SELECT k, a(k);
      END;
      $$
      DELIMITER ;
      

      Leads to:

      CS 13.2.0 9d7ab2c0092df4bc73b64b915464aecf7e5fe6c4 (Optimized, Clang 18.1.3-11) Build 06/10/2026

      ERROR 1525 (HY000): Incorrect ASSOCIATIVE ARRAY KEY value: '-9223372036854775808'
      

      CS 13.2.0 9d7ab2c0092df4bc73b64b915464aecf7e5fe6c4 (Debug, Clang 18.1.3-11) Build 06/10/2026

      Core was generated by `/test/MD061026-mariadb-13.2.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --loo'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x00005b20c6c982a9 in Item_splocal::append_value_for_log (this=0x729534040d80, thd=0x729534000d60, str=0x7a96045dd318)at /test/13.2_dbg/sql/sp_head.cc:147
       
      [Current thread is 1 (LWP 3248024)]
      (gdb) bt
      #0  0x00005b20c6c982a9 in Item_splocal::append_value_for_log (this=0x729534040d80, thd=0x729534000d60, str=0x7a96045dd318)at /test/13.2_dbg/sql/sp_head.cc:147
      #1  0x00005b20c7eaceb0 in Item_splocal_assoc_array_element::append_for_log (this=0x729534040d80, thd=0x729534000d60, str=0x7a96045dd318)at /test/13.2_dbg/plugin/type_assoc_array/sql_type_assoc_array.cc:2184
      #2  0x00005b20c6e2d8d2 in Copy_query_with_rewrite::append (this=0x7a96045dd280, p=0x729534040e28) at /test/13.2_dbg/sql/item.h:560
      #3  0x00005b20c70b376f in subst_spvars (thd=0x729534000d60, instr=0x729534041750, query_str=0x729534041808)at /test/13.2_dbg/sql/sp_instr.cc:246
      #4  0x00005b20c70b2f8a in sp_instr_stmt::execute (this=0x729534041750, thd=0x729534000d60, nextp=0x7a96045dda48)at /test/13.2_dbg/sql/sp_instr.cc:1196
      #5  0x00005b20c6c9bb2c in sp_head::execute (this=0x7295340396d0, thd=0x729534000d60, merge_da_on_success=true)at /test/13.2_dbg/sql/sp_head.cc:1346
      #6  0x00005b20c6c9e58e in sp_head::execute_procedure (this=0x7295340396d0, thd=0x729534000d60, args=0x7295340062e8)at /test/13.2_dbg/sql/sp_head.cc:2421
      #7  0x00005b20c6dd4dfb in do_execute_sp (thd=0x729534000d60, sp=0x7295340396d0)at /test/13.2_dbg/sql/sql_parse.cc:3099
      #8  0x00005b20c6ddfdd3 in mysql_execute_command (thd=0x729534000d60, is_called_from_prepared_stmt=false) at /test/13.2_dbg/sql/sql_parse.cc:5703
      #9  0x00005b20c6dcfdb4 in mysql_parse (thd=0x729534000d60, rawbuf=0x72953401a4d0 "DECLARE\n  TYPE t IS TABLE OF INT INDEX BY BIGINT;\n  a t;\n  k BIGINT := -9223372036854775808;\nBEGIN\n  a(k) := 1;\n  SELECT k, a(k);\nEND", length=133, parser_state=0x7a96045dfa80)at /test/13.2_dbg/sql/sql_parse.cc:8005
      #10 0x00005b20c6dcd17d in dispatch_command (command=COM_QUERY, thd=0x729534000d60, packet=0x72953400b701 "DECLARE\n  TYPE t IS TABLE OF INT INDEX BY BIGINT;\n  a t;\n  k BIGINT := -9223372036854775808;\nBEGIN\n  a(k) := 1;\n  SELECT k, a(k);\nEND;", packet_length=134, blocking=true)at /test/13.2_dbg/sql/sql_parse.cc:1903
      #11 0x00005b20c6dd0963 in do_command (thd=0x729534000d60, blocking=true)at /test/13.2_dbg/sql/sql_parse.cc:1437
      #12 0x00005b20c6fd6cd9 in do_handle_one_connection (connect=0x5b20cc336cc0, put_in_cache=true) at /test/13.2_dbg/sql/sql_connect.cc:1514
      #13 0x00005b20c6fd6a7e in handle_one_connection (arg=0x5b20cc2cf6a0)at /test/13.2_dbg/sql/sql_connect.cc:1426
      #14 0x00007a962cc9cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #15 0x00007a962cd29ecc 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  061026  76ed5b7ea0c9cddfe9386aee4a5ff42a2adf1593  No bug found
      CS  10.11  opt  061026  76ed5b7ea0c9cddfe9386aee4a5ff42a2adf1593  No bug found
      CS  11.4   dbg  061026  b6398296aeeeb253bdb3d1dd1620d2bb03836bf7  No bug found
      CS  11.4   opt  061026  b6398296aeeeb253bdb3d1dd1620d2bb03836bf7  No bug found
      CS  11.8   dbg  061026  dddbd5ff427894941fee3d7528ca2058e026b82e  No bug found
      CS  11.8   opt  061026  dddbd5ff427894941fee3d7528ca2058e026b82e  No bug found
      CS  12.3   dbg  061026  07b869588831fb9ebc6364c77cba105d6cca3b77  ERROR 1525 Incorrect ASSOCIATIVE ARRAY KEY value: '-9223372036854775808' 
      CS  12.3   opt  061026  07b869588831fb9ebc6364c77cba105d6cca3b77  ERROR 1525 Incorrect ASSOCIATIVE ARRAY KEY value: '-9223372036854775808'
      CS  13.0   dbg  061026  620a4b5624222048fece7fe1789978ae0675cae2  ERROR 1525 Incorrect ASSOCIATIVE ARRAY KEY value: '-9223372036854775808'
      CS  13.0   opt  061026  620a4b5624222048fece7fe1789978ae0675cae2  ERROR 1525 Incorrect ASSOCIATIVE ARRAY KEY value: '-9223372036854775808'
      CS  13.1   dbg  061026  87e62ca17270e163a6d41b3fc8d6f4d440f1bb88  ERROR 1525 Incorrect ASSOCIATIVE ARRAY KEY value: '-9223372036854775808'
      CS  13.1   opt  061026  87e62ca17270e163a6d41b3fc8d6f4d440f1bb88  ERROR 1525 Incorrect ASSOCIATIVE ARRAY KEY value: '-9223372036854775808'
      CS  13.2   dbg  061026  9d7ab2c0092df4bc73b64b915464aecf7e5fe6c4  SIGSEGV|Item_splocal::append_value_for_log|Item_splocal_assoc_array_element::append_for_log|Copy_query_with_rewrite::append|subst_spvars
      CS  13.2   opt  061026  9d7ab2c0092df4bc73b64b915464aecf7e5fe6c4  ERROR 1525 Incorrect ASSOCIATIVE ARRAY KEY value: '-9223372036854775808'
      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
      ES  12.3   dbg  280926  082387a5f3cbb877157998bb4baa95928f4aa121  No bug found
      ES  12.3   opt  280926  082387a5f3cbb877157998bb4baa95928f4aa121  No bug found
      

      Attachments

        Issue Links

          Activity

            People

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