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

UBSAN shift exponent X is too large for 32-bit type 'unsigned int' in best_access_path

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.5, 10.6, 10.11, 11.1(EOL), 11.2(EOL), 11.3(EOL), 11.4, 11.5(EOL)
    • 10.5, 10.6, 10.11, 11.4
    • None

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t(a1 INT,a2 INT,a3 INT,a4 INT,a5 INT,a6 INT,a7 INT,a8 INT,a9 INT,a10 INT,a11 INT,a12 INT,a13 INT,a14 INT,a15 INT,a16 INT,a17 INT,a18 INT,a19 INT,a20 INT,a21 INT,a22 INT,a23 INT,a24 INT,a25 INT,a26 INT,a27 INT,a28 INT,a29 INT,a30 INT,a31 INT,a32 INT,KEY(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32)) ENGINE=INNODB;
      EXPLAIN SELECT * FROM t WHERE a1 in(0) AND a2=0;
      

      Leads to:

      11.5.0 f582ea4d5b04df384e5da44eaeac33494712c97b (Optimized, UBASAN)

      /test/server/sql/sql_select.cc:8739:43: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
          #0 0x55b7f10ad783 in best_access_path(JOIN*, st_join_table*, unsigned long long, POSITION const*, unsigned int, bool, double, POSITION*, POSITION*) /test/server/sql/sql_select.cc:8739
          #1 0x55b7f10c8c2a in get_costs_for_tables /test/server/sql/sql_select.cc:11288
          #2 0x55b7f10d02a3 in best_extension_by_limited_search /test/server/sql/sql_select.cc:11545
          #3 0x55b7f10e8d8a in greedy_search /test/server/sql/sql_select.cc:10516
          #4 0x55b7f10e8d8a in choose_plan(JOIN*, unsigned long long, TABLE_LIST*) /test/server/sql/sql_select.cc:10035
          #5 0x55b7f10fe603 in make_join_statistics /test/server/sql/sql_select.cc:6271
          #6 0x55b7f1135718 in JOIN::optimize_inner() /test/server/sql/sql_select.cc:2657
          #7 0x55b7f11379a3 in JOIN::optimize() /test/server/sql/sql_select.cc:1966
          #8 0x55b7f1138150 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /test/server/sql/sql_select.cc:5290
          #9 0x55b7f113e483 in mysql_explain_union(THD*, st_select_lex_unit*, select_result*) /test/server/sql/sql_select.cc:30643
          #10 0x55b7f0c7a737 in execute_sqlcom_select /test/server/sql/sql_parse.cc:6032
          #11 0x55b7f0cc1b1f in mysql_execute_command(THD*, bool) /test/server/sql/sql_parse.cc:3942
          #12 0x55b7f0c4796f in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/server/sql/sql_parse.cc:7815
          #13 0x55b7f0cf4ce0 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/server/sql/sql_parse.cc:1892
          #14 0x55b7f0d07881 in do_command(THD*, bool) /test/server/sql/sql_parse.cc:1405
          #15 0x55b7f17e6f09 in do_handle_one_connection(CONNECT*, bool) /test/server/sql/sql_connect.cc:1445
          #16 0x55b7f17e9683 in handle_one_connection /test/server/sql/sql_connect.cc:1347
          #17 0x152b5a234608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477
          #18 0x152b594a9132 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x11f132)
      

      Setup:

      Compiled with a recent version of GCC (I use GCC 12.3.0) and:
          -DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON -DWITH_UBSAN=ON -DWSREP_LIB_WITH_ASAN=ON
      Set before execution:
          export UBSAN_OPTIONS=print_stacktrace=1
      

      Bug confirmed present in:
      MariaDB: 10.5.25 (opt), 10.5.25 (dbg), 10.6.18 (dbg), 10.11.8 (dbg), 10.11.8 (opt), 11.2.4 (dbg), 11.2.4 (opt), 11.4.2 (opt), 11.5.0 (dbg), 11.5.0 (opt)

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            ramesh Ramesh Sivaraman
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.