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

UBSAN negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoll_mb2_or_mb4

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.4, 11.5
    • 11.4, 11.5
    • None

    Description

      SET character_set_connection=utf32;
      SELECT CONV('-AzL8n0Y58m8', -62, -10);
      

      Leads to:

      11.4.2 058510a62ff9056223685d2bc544c6bff13d226f (Optimized, UBASAN)

      /test/server_opt_san/strings/ctype-ucs2.c:519:39: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself
          #0 0x55be28531ecf in my_strntoll_mb2_or_mb4 /test/server_opt_san/strings/ctype-ucs2.c:519
          #1 0x55be2646629c in charset_info_st::strntoll(char const*, unsigned long, int, char**, int*) const /test/server_opt_san/include/m_ctype.h:919
          #2 0x55be2646629c in Item_func_conv::val_str(String*) /test/server_opt_san/sql/item_strfunc.cc:3952
          #3 0x55be2553753d in Type_handler::Item_send_str(Item*, Protocol*, st_value*) const /test/server_opt_san/sql/sql_type.cc:7496
          #4 0x55be23fa0ec1 in Protocol::send_result_set_row(List<Item>*) /test/server_opt_san/sql/protocol.cc:1333
          #5 0x55be24299fd9 in select_send::send_data(List<Item>&) /test/server_opt_san/sql/sql_class.cc:3187
          #6 0x55be24a48544 in select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long) /test/server_opt_san/sql/sql_class.h:5995
          #7 0x55be24a48544 in select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long) /test/server_opt_san/sql/sql_class.h:5985
          #8 0x55be24a48544 in JOIN::exec_inner() /test/server_opt_san/sql/sql_select.cc:4862
          #9 0x55be24a4cc29 in JOIN::exec() /test/server_opt_san/sql/sql_select.cc:4774
          #10 0x55be24a3a10c 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_opt_san/sql/sql_select.cc:5304
          #11 0x55be24a3dda3 in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/server_opt_san/sql/sql_select.cc:630
          #12 0x55be24609def in execute_sqlcom_select /test/server_opt_san/sql/sql_parse.cc:6094
          #13 0x55be24659bf5 in mysql_execute_command(THD*, bool) /test/server_opt_san/sql/sql_parse.cc:3943
          #14 0x55be245da1d0 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/server_opt_san/sql/sql_parse.cc:7815
          #15 0x55be2462fb00 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/server_opt_san/sql/sql_parse.cc:1893
          #16 0x55be2463b79d in do_command(THD*, bool) /test/server_opt_san/sql/sql_parse.cc:1406
          #17 0x55be24fa01bd in do_handle_one_connection(CONNECT*, bool) /test/server_opt_san/sql/sql_connect.cc:1437
          #18 0x55be24fa282c in handle_one_connection /test/server_opt_san/sql/sql_connect.cc:1339
          #19 0x14a5abbac608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477
          #20 0x14a5aae21132 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x11f132)
      

      Bug confirmed present in:
      MariaDB: 11.4.2 (dbg), 11.4.2 (opt), 11.5.0 (dbg), 11.5.0 (opt)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.4.34 (dbg), 10.4.34 (opt), 10.5.25 (dbg), 10.5.25 (opt), 10.6.18 (dbg), 10.6.18 (opt), 10.11.8 (dbg), 10.11.8 (opt), 11.0.6 (dbg), 11.0.6 (opt), 11.1.5 (dbg), 11.1.5 (opt), 11.2.4 (dbg), 11.2.4 (opt), 11.3.3 (dbg), 11.3.3 (opt)

      Attachments

        Activity

          People

            bar Alexander Barkov
            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.