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

ASAN errors in Binary_string::replace upon using format_pico_time in view

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.0(EOL), 11.4, 11.7(EOL), 11.8
    • 11.4, 11.8
    • Server
    • None

    Description

      create table t (a int, b int);
      insert into t values (1,11083000),(5,12900000);
      create view v AS select a,format_pico_time(b) AS c from t;
       
      select insert(c,a,a,c) from v;
       
      drop view v;
      drop table t;
      

      or, using a sys schema:

      SELECT INSERT(avg_latency, total, total, avg_latency) FROM sys.user_summary_by_stages;
      

      11.4 0771110266ff5c04216af4bf1243c65f8c67ccf4

      ==1840404==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x60f00001289c,0x60f0000128a4) and [0x60f000012898, 0x60f0000128a0) overlap
          #0 0x7fdc09e47f4f in __interceptor_memcpy ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827
          #1 0x55a9e738c509 in Binary_string::replace(unsigned int, unsigned int, char const*, unsigned int) /data/bld/11.4-asan/sql/sql_string.cc:748
          #2 0x55a9e7c55f4a in Binary_string::replace(unsigned int, unsigned int, Binary_string const&) /data/bld/11.4-asan/sql/sql_string.h:853
          #3 0x55a9e7c2bcf7 in Item_func_insert::val_str(String*) /data/bld/11.4-asan/sql/item_strfunc.cc:1951
          #4 0x55a9e77e144f in Type_handler::Item_send_str(Item*, Protocol*, st_value*) const /data/bld/11.4-asan/sql/sql_type.cc:7680
          #5 0x55a9e75506c1 in Type_handler_string_result::Item_send(Item*, Protocol*, st_value*) const /data/bld/11.4-asan/sql/sql_type.h:5610
          #6 0x55a9e6d0b777 in Item::send(Protocol*, st_value*) /data/bld/11.4-asan/sql/item.h:1261
          #7 0x55a9e6ddbdde in Protocol::send_result_set_row(List<Item>*) /data/bld/11.4-asan/sql/protocol.cc:1333
          #8 0x55a9e6f7fb2d in select_send::send_data(List<Item>&) /data/bld/11.4-asan/sql/sql_class.cc:3264
          #9 0x55a9e72bd8bc in select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long) /data/bld/11.4-asan/sql/sql_class.h:6095
          #10 0x55a9e727398c in end_send /data/bld/11.4-asan/sql/sql_select.cc:25414
          #11 0x55a9e726b760 in evaluate_join_record /data/bld/11.4-asan/sql/sql_select.cc:24340
          #12 0x55a9e726a5cc in sub_select(JOIN*, st_join_table*, bool) /data/bld/11.4-asan/sql/sql_select.cc:24144
          #13 0x55a9e7267829 in do_select /data/bld/11.4-asan/sql/sql_select.cc:23618
          #14 0x55a9e71e3838 in JOIN::exec_inner() /data/bld/11.4-asan/sql/sql_select.cc:5045
          #15 0x55a9e71e0c37 in JOIN::exec() /data/bld/11.4-asan/sql/sql_select.cc:4831
          #16 0x55a9e71e52f0 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*) /data/bld/11.4-asan/sql/sql_select.cc:5361
          #17 0x55a9e71b371a in handle_select(THD*, LEX*, select_result*, unsigned long long) /data/bld/11.4-asan/sql/sql_select.cc:642
          #18 0x55a9e70d5477 in execute_sqlcom_select /data/bld/11.4-asan/sql/sql_parse.cc:6183
          #19 0x55a9e70c5257 in mysql_execute_command(THD*, bool) /data/bld/11.4-asan/sql/sql_parse.cc:3975
          #20 0x55a9e70dfeef in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/bld/11.4-asan/sql/sql_parse.cc:7907
          #21 0x55a9e70b6f53 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/bld/11.4-asan/sql/sql_parse.cc:1904
          #22 0x55a9e70b3c8b in do_command(THD*, bool) /data/bld/11.4-asan/sql/sql_parse.cc:1417
          #23 0x55a9e7597e6a in do_handle_one_connection(CONNECT*, bool) /data/bld/11.4-asan/sql/sql_connect.cc:1408
          #24 0x55a9e75979c9 in handle_one_connection /data/bld/11.4-asan/sql/sql_connect.cc:1320
          #25 0x55a9e82154df in pfs_spawn_thread /data/bld/11.4-asan/storage/perfschema/pfs.cc:2201
          #26 0x7fdc092a81c3 in start_thread nptl/pthread_create.c:442
          #27 0x7fdc0932885b in clone3 ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
       
      0x60f00001289c is located 28 bytes inside of 168-byte region [0x60f000012880,0x60f000012928)
      allocated by thread T5 here:
          #0 0x7fdc09eb89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x55a9e8faeef8 in my_malloc /data/bld/11.4-asan/mysys/my_malloc.c:93
          #2 0x55a9e738850a in Binary_string::realloc_raw(unsigned long) /data/bld/11.4-asan/sql/sql_string.cc:104
          #3 0x55a9e6da793c in Binary_string::realloc_with_extra(unsigned long) /data/bld/11.4-asan/sql/sql_string.h:820
          #4 0x55a9e6da7a90 in Binary_string::realloc_with_extra_if_needed(unsigned long) /data/bld/11.4-asan/sql/sql_string.h:832
          #5 0x55a9e738c416 in Binary_string::replace(unsigned int, unsigned int, char const*, unsigned int) /data/bld/11.4-asan/sql/sql_string.cc:742
          #6 0x55a9e7c55f4a in Binary_string::replace(unsigned int, unsigned int, Binary_string const&) /data/bld/11.4-asan/sql/sql_string.h:853
          #7 0x55a9e7c2bcf7 in Item_func_insert::val_str(String*) /data/bld/11.4-asan/sql/item_strfunc.cc:1951
          #8 0x55a9e77e144f in Type_handler::Item_send_str(Item*, Protocol*, st_value*) const /data/bld/11.4-asan/sql/sql_type.cc:7680
          #9 0x55a9e75506c1 in Type_handler_string_result::Item_send(Item*, Protocol*, st_value*) const /data/bld/11.4-asan/sql/sql_type.h:5610
          #10 0x55a9e6d0b777 in Item::send(Protocol*, st_value*) /data/bld/11.4-asan/sql/item.h:1261
          #11 0x55a9e6ddbdde in Protocol::send_result_set_row(List<Item>*) /data/bld/11.4-asan/sql/protocol.cc:1333
          #12 0x55a9e6f7fb2d in select_send::send_data(List<Item>&) /data/bld/11.4-asan/sql/sql_class.cc:3264
          #13 0x55a9e72bd8bc in select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long) /data/bld/11.4-asan/sql/sql_class.h:6095
          #14 0x55a9e727398c in end_send /data/bld/11.4-asan/sql/sql_select.cc:25414
          #15 0x55a9e726b760 in evaluate_join_record /data/bld/11.4-asan/sql/sql_select.cc:24340
          #16 0x55a9e7269f9f in sub_select(JOIN*, st_join_table*, bool) /data/bld/11.4-asan/sql/sql_select.cc:24107
          #17 0x55a9e7267829 in do_select /data/bld/11.4-asan/sql/sql_select.cc:23618
          #18 0x55a9e71e3838 in JOIN::exec_inner() /data/bld/11.4-asan/sql/sql_select.cc:5045
          #19 0x55a9e71e0c37 in JOIN::exec() /data/bld/11.4-asan/sql/sql_select.cc:4831
          #20 0x55a9e71e52f0 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*) /data/bld/11.4-asan/sql/sql_select.cc:5361
          #21 0x55a9e71b371a in handle_select(THD*, LEX*, select_result*, unsigned long long) /data/bld/11.4-asan/sql/sql_select.cc:642
          #22 0x55a9e70d5477 in execute_sqlcom_select /data/bld/11.4-asan/sql/sql_parse.cc:6183
          #23 0x55a9e70c5257 in mysql_execute_command(THD*, bool) /data/bld/11.4-asan/sql/sql_parse.cc:3975
          #24 0x55a9e70dfeef in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/bld/11.4-asan/sql/sql_parse.cc:7907
          #25 0x55a9e70b6f53 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/bld/11.4-asan/sql/sql_parse.cc:1904
          #26 0x55a9e70b3c8b in do_command(THD*, bool) /data/bld/11.4-asan/sql/sql_parse.cc:1417
          #27 0x55a9e7597e6a in do_handle_one_connection(CONNECT*, bool) /data/bld/11.4-asan/sql/sql_connect.cc:1408
          #28 0x55a9e75979c9 in handle_one_connection /data/bld/11.4-asan/sql/sql_connect.cc:1320
          #29 0x55a9e82154df in pfs_spawn_thread /data/bld/11.4-asan/storage/perfschema/pfs.cc:2201
       
      Thread T5 created by T0 here:
          #0 0x7fdc09e49726 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:207
          #1 0x55a9e821121a in my_thread_create /data/bld/11.4-asan/storage/perfschema/my_thread.h:52
          #2 0x55a9e82158ce in pfs_spawn_thread_v1 /data/bld/11.4-asan/storage/perfschema/pfs.cc:2252
          #3 0x55a9e6ce0840 in inline_mysql_thread_create /data/bld/11.4-asan/include/mysql/psi/mysql_thread.h:1139
          #4 0x55a9e6cf8609 in create_thread_to_handle_connection(CONNECT*) /data/bld/11.4-asan/sql/mysqld.cc:6166
          #5 0x55a9e6cf8c2e in create_new_thread(CONNECT*) /data/bld/11.4-asan/sql/mysqld.cc:6228
          #6 0x55a9e6cf8f19 in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/bld/11.4-asan/sql/mysqld.cc:6290
          #7 0x55a9e6cf9ba1 in handle_connections_sockets() /data/bld/11.4-asan/sql/mysqld.cc:6402
          #8 0x55a9e6cf67e5 in run_main_loop /data/bld/11.4-asan/sql/mysqld.cc:5645
          #9 0x55a9e6cf7ed8 in mysqld_main(int, char**) /data/bld/11.4-asan/sql/mysqld.cc:6067
          #10 0x55a9e6cdfb08 in main /data/bld/11.4-asan/sql/main.cc:34
          #11 0x7fdc09246249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
       
      0x60f000012898 is located 24 bytes inside of 168-byte region [0x60f000012880,0x60f000012928)
      allocated by thread T5 here:
          #0 0x7fdc09eb89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x55a9e8faeef8 in my_malloc /data/bld/11.4-asan/mysys/my_malloc.c:93
          #2 0x55a9e738850a in Binary_string::realloc_raw(unsigned long) /data/bld/11.4-asan/sql/sql_string.cc:104
          #3 0x55a9e6da793c in Binary_string::realloc_with_extra(unsigned long) /data/bld/11.4-asan/sql/sql_string.h:820
          #4 0x55a9e6da7a90 in Binary_string::realloc_with_extra_if_needed(unsigned long) /data/bld/11.4-asan/sql/sql_string.h:832
          #5 0x55a9e738c416 in Binary_string::replace(unsigned int, unsigned int, char const*, unsigned int) /data/bld/11.4-asan/sql/sql_string.cc:742
          #6 0x55a9e7c55f4a in Binary_string::replace(unsigned int, unsigned int, Binary_string const&) /data/bld/11.4-asan/sql/sql_string.h:853
          #7 0x55a9e7c2bcf7 in Item_func_insert::val_str(String*) /data/bld/11.4-asan/sql/item_strfunc.cc:1951
          #8 0x55a9e77e144f in Type_handler::Item_send_str(Item*, Protocol*, st_value*) const /data/bld/11.4-asan/sql/sql_type.cc:7680
          #9 0x55a9e75506c1 in Type_handler_string_result::Item_send(Item*, Protocol*, st_value*) const /data/bld/11.4-asan/sql/sql_type.h:5610
          #10 0x55a9e6d0b777 in Item::send(Protocol*, st_value*) /data/bld/11.4-asan/sql/item.h:1261
          #11 0x55a9e6ddbdde in Protocol::send_result_set_row(List<Item>*) /data/bld/11.4-asan/sql/protocol.cc:1333
          #12 0x55a9e6f7fb2d in select_send::send_data(List<Item>&) /data/bld/11.4-asan/sql/sql_class.cc:3264
          #13 0x55a9e72bd8bc in select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long) /data/bld/11.4-asan/sql/sql_class.h:6095
          #14 0x55a9e727398c in end_send /data/bld/11.4-asan/sql/sql_select.cc:25414
          #15 0x55a9e726b760 in evaluate_join_record /data/bld/11.4-asan/sql/sql_select.cc:24340
          #16 0x55a9e7269f9f in sub_select(JOIN*, st_join_table*, bool) /data/bld/11.4-asan/sql/sql_select.cc:24107
          #17 0x55a9e7267829 in do_select /data/bld/11.4-asan/sql/sql_select.cc:23618
          #18 0x55a9e71e3838 in JOIN::exec_inner() /data/bld/11.4-asan/sql/sql_select.cc:5045
          #19 0x55a9e71e0c37 in JOIN::exec() /data/bld/11.4-asan/sql/sql_select.cc:4831
          #20 0x55a9e71e52f0 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*) /data/bld/11.4-asan/sql/sql_select.cc:5361
          #21 0x55a9e71b371a in handle_select(THD*, LEX*, select_result*, unsigned long long) /data/bld/11.4-asan/sql/sql_select.cc:642
          #22 0x55a9e70d5477 in execute_sqlcom_select /data/bld/11.4-asan/sql/sql_parse.cc:6183
          #23 0x55a9e70c5257 in mysql_execute_command(THD*, bool) /data/bld/11.4-asan/sql/sql_parse.cc:3975
          #24 0x55a9e70dfeef in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/bld/11.4-asan/sql/sql_parse.cc:7907
          #25 0x55a9e70b6f53 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/bld/11.4-asan/sql/sql_parse.cc:1904
          #26 0x55a9e70b3c8b in do_command(THD*, bool) /data/bld/11.4-asan/sql/sql_parse.cc:1417
          #27 0x55a9e7597e6a in do_handle_one_connection(CONNECT*, bool) /data/bld/11.4-asan/sql/sql_connect.cc:1408
          #28 0x55a9e75979c9 in handle_one_connection /data/bld/11.4-asan/sql/sql_connect.cc:1320
          #29 0x55a9e82154df in pfs_spawn_thread /data/bld/11.4-asan/storage/perfschema/pfs.cc:2201
       
      SUMMARY: AddressSanitizer: memcpy-param-overlap ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827 in __interceptor_memcpy
      ==1840404==ABORTING
      

      The failure started happening after this commit in 11.0.2:

      commit c2b69163934016afa4bb3b274cddaacec92fcb61
      Author: Sergei Golubchik
      Date:   Mon Mar 27 18:50:49 2023 +0200
       
          MDEV-19629 post-merge fixes
      

      Attachments

        Issue Links

          Activity

            No workflow transitions have been executed yet.

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              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.