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

UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoll_8bit

    XMLWordPrintable

Details

    Description

      CREATE TABLE t (a INT);
      ALTER TABLE t CHANGE COLUMN a aa CHAR(100);
      INSERT INTO t VALUES (-9223372036854775808);
      ALTER TABLE t CHANGE COLUMN aa a INT;
      

      Leads to

      11.0.4 5e2d08b5e89ec600f46021d99beeb2635eef4f45 (Optimized, UBASAN)

      /test/11.0_opt_san/strings/ctype-simple.c:671:38: 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 0x56077ded69fd in my_strntoll_8bit /test/11.0_opt_san/strings/ctype-simple.c:671
          #1 0x56077b61a73d in charset_info_st::strntoll(char const*, unsigned long, int, char**, int*) const /test/11.0_opt_san/include/m_ctype.h:917
          #2 0x56077b61a73d in Value_source::Converter_strntoll::Converter_strntoll(charset_info_st const*, char const*, unsigned long) /test/11.0_opt_san/sql/field.h:230
          #3 0x56077b61a73d in Value_source::Converter_strntoll_with_warn::Converter_strntoll_with_warn(THD*, Value_source::Warn_filter, charset_info_st const*, char const*, unsigned long) /test/11.0_opt_san/sql/field.h:293
          #4 0x56077b61a73d in Field_string::val_int() /test/11.0_opt_san/sql/field.cc:7539
          #5 0x56077b6bb55f in Field::do_field_int(Copy_field*) /test/11.0_opt_san/sql/field_conv.cc:402
          #6 0x56077a7ce8b3 in copy_data_between_tables /test/11.0_opt_san/sql/sql_table.cc:11753
          #7 0x56077a843124 in mysql_alter_table(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, Table_specification_st*, TABLE_LIST*, Recreate_info*, Alter_info*, unsigned int, st_order*, bool, bool) /test/11.0_opt_san/sql/sql_table.cc:11033
          #8 0x56077ab60a70 in Sql_cmd_alter_table::execute(THD*) /test/11.0_opt_san/sql/sql_alter.cc:602
          #9 0x56077a219904 in mysql_execute_command(THD*, bool) /test/11.0_opt_san/sql/sql_parse.cc:6025
          #10 0x56077a1a8160 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.0_opt_san/sql/sql_parse.cc:8030
          #11 0x56077a1fd068 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.0_opt_san/sql/sql_parse.cc:1894
          #12 0x56077a20876d in do_command(THD*, bool) /test/11.0_opt_san/sql/sql_parse.cc:1407
          #13 0x56077ab35abd in do_handle_one_connection(CONNECT*, bool) /test/11.0_opt_san/sql/sql_connect.cc:1416
          #14 0x56077ab3812c in handle_one_connection /test/11.0_opt_san/sql/sql_connect.cc:1318
          #15 0x153e501ec608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477
          #16 0x153e4f461132 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x11f132)
      

      Bug confirmed present in:
      MariaDB: 10.4.33 (dbg), 10.4.33 (opt), 10.5.24 (opt), 10.5.24 (dbg), 10.6.17 (dbg), 10.6.17 (opt), 10.11.7 (dbg), 10.11.7 (opt), 11.0.5 (dbg), 11.0.5 (opt), 11.1.4 (dbg), 11.1.4 (opt), 11.2.3 (dbg), 11.2.3 (opt), 11.3.2 (dbg), 11.3.2 (opt), 11.4.0 (dbg), 11.4.0 (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.