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

Assertion `(*endptr - (const char *) s) % 2 == 0' failed in my_strtoll10_mb2

    XMLWordPrintable

Details

    Description

      SET CHARACTER_SET_CONNECTION= utf16;
      PREPARE stmt FROM "SELECT SUBSTR('foo', 1, IFNULL(10000000000000000,'1'))";
      

      10.2 737c3025

      mysqld: /data/src/10.2/strings/ctype-ucs2.c:848: my_strtoll10_mb2: Assertion `(*endptr - (const char *) s) % 2 == 0' failed.
      200712 14:27:24 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f6f2568bf12 in __GI___assert_fail (assertion=0x555ca29f1a68 "(*endptr - (const char *) s) % 2 == 0", file=0x555ca29f1a40 "/data/src/10.2/strings/ctype-ucs2.c", line=848, function=0x555ca29f2090 <__PRETTY_FUNCTION__.11298> "my_strtoll10_mb2") at assert.c:101
      #8  0x0000555ca256a589 in my_strtoll10_mb2 (cs=0x555ca303e3c0 <my_charset_utf16_general_ci>, nptr=0x7f6ec015f8f0 "1", '0' <repeats 16 times>, "\245\245\245\245\245\245\245h4z\025\217\217\217\217\240", endptr=0x7f6f2453fda0, error=0x7f6f2453fda8) at /data/src/10.2/strings/ctype-ucs2.c:848
      #9  0x0000555ca1a9efe4 in Value_source::Converter_strtoll10::Converter_strtoll10 (this=0x7f6f2453fda0, cs=0x555ca303e3c0 <my_charset_utf16_general_ci>, str=0x7f6ec015f8f0 "1", '0' <repeats 16 times>, "\245\245\245\245\245\245\245h4z\025\217\217\217\217\240", length=17) at /data/src/10.2/sql/field.h:196
      #10 0x0000555ca1a9f0ae in Value_source::Converter_strtoll10_with_warn::Converter_strtoll10_with_warn (this=0x7f6f2453fda0, thd=0x7f6ec0000af0, filter=..., cs=0x555ca303e3c0 <my_charset_utf16_general_ci>, str=0x7f6ec015f8f0 "1", '0' <repeats 16 times>, "\245\245\245\245\245\245\245h4z\025\217\217\217\217\240", length=17) at /data/src/10.2/sql/field.h:253
      #11 0x0000555ca1a9f14e in Value_source::longlong_from_string_with_check (this=0x7f6ec0082050, cs=0x555ca303e3c0 <my_charset_utf16_general_ci>, cptr=0x7f6ec015f8f0 "1", '0' <repeats 16 times>, "\245\245\245\245\245\245\245h4z\025\217\217\217\217\240", end=0x7f6ec015f901 "\245\245\245\245\245\245\245h4z\025\217\217\217\217\240") at /data/src/10.2/sql/field.h:291
      #12 0x0000555ca1e17c78 in Value_source::longlong_from_string_with_check (this=0x7f6ec0082050, str=0x7f6ec0082080) at /data/src/10.2/sql/field.h:325
      #13 0x0000555ca1e5ce5d in Item_func_hybrid_field_type::val_int (this=0x7f6ec0082050) at /data/src/10.2/sql/item_func.cc:959
      #14 0x0000555ca1e9095c in Item_func_substr::fix_length_and_dec (this=0x7f6ec0082120) at /data/src/10.2/sql/item_strfunc.cc:1710
      #15 0x0000555ca1e5a6b4 in Item_func::fix_fields (this=0x7f6ec0082120, thd=0x7f6ec0000af0, ref=0x7f6ec0082220) at /data/src/10.2/sql/item_func.cc:230
      #16 0x0000555ca1e8ab5d in Item_str_func::fix_fields (this=0x7f6ec0082120, thd=0x7f6ec0000af0, ref=0x7f6ec0082220) at /data/src/10.2/sql/item_strfunc.cc:106
      #17 0x0000555ca1b041fb in setup_fields (thd=0x7f6ec0000af0, ref_pointer_array=..., fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7f6ec0012980, pre_fix=0x7f6ec0080f50, allow_sum_func=true) at /data/src/10.2/sql/sql_base.cc:7238
      #18 0x0000555ca1ba98ed in JOIN::prepare (this=0x7f6ec0012660, tables_init=0x0, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7f6ec0080e10, unit_arg=0x7f6ec00806d0) at /data/src/10.2/sql/sql_select.cc:811
      #19 0x0000555ca1c55d03 in st_select_lex_unit::prepare (this=0x7f6ec00806d0, thd_arg=0x7f6ec0000af0, sel_result=0x0, additional_options=0) at /data/src/10.2/sql/sql_union.cc:586
      #20 0x0000555ca1b8dbdc in mysql_test_select (stmt=0x7f6ec0006600, tables=0x0) at /data/src/10.2/sql/sql_prepare.cc:1602
      #21 0x0000555ca1b8f7e0 in check_prepared_statement (stmt=0x7f6ec0006600) at /data/src/10.2/sql/sql_prepare.cc:2400
      #22 0x0000555ca1b9362d in Prepared_statement::prepare (this=0x7f6ec0006600, packet=0x7f6ec00125f0 "SELECT SUBSTR('foo', 1, IFNULL(1", '0' <repeats 16 times>, ",'1'))", packet_len=54) at /data/src/10.2/sql/sql_prepare.cc:4064
      #23 0x0000555ca1b905cc in mysql_sql_stmt_prepare (thd=0x7f6ec0000af0) at /data/src/10.2/sql/sql_prepare.cc:2878
      #24 0x0000555ca1b6a8ce in mysql_execute_command (thd=0x7f6ec0000af0) at /data/src/10.2/sql/sql_parse.cc:3535
      #25 0x0000555ca1b77d53 in mysql_parse (thd=0x7f6ec0000af0, rawbuf=0x7f6ec0012238 "PREPARE stmt FROM \"SELECT SUBSTR('foo', 1, IFNULL(1", '0' <repeats 16 times>, ",'1'))\"", length=74, parser_state=0x7f6f24541660, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7733
      #26 0x0000555ca1b6607f in dispatch_command (command=COM_QUERY, thd=0x7f6ec0000af0, packet=0x7f6ec0066f41 "PREPARE stmt FROM \"SELECT SUBSTR('foo', 1, IFNULL(1", '0' <repeats 16 times>, ",'1'))\"", packet_length=74, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1824
      #27 0x0000555ca1b64afa in do_command (thd=0x7f6ec0000af0) at /data/src/10.2/sql/sql_parse.cc:1377
      #28 0x0000555ca1cbaa6f in do_handle_one_connection (connect=0x555ca53a0740) at /data/src/10.2/sql/sql_connect.cc:1336
      #29 0x0000555ca1cba7da in handle_one_connection (arg=0x555ca53a0740) at /data/src/10.2/sql/sql_connect.cc:1241
      #30 0x00007f6f276144a4 in start_thread (arg=0x7f6f24542700) at pthread_create.c:456
      #31 0x00007f6f25748d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Also reproducible with ucs2.
      Reproducible on 10.1-10.5 debug builds.
      No obvious problem on a non-debug build, other than an ugly warning message

      Warnings:
      Warning	1292	Truncated incorrect INTEGER value: '?????????'
      

      Same with ucs2

      Attachments

        Activity

          People

            bar Alexander Barkov
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            5 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.