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

AddressSanitizer: memcpy-param-overlap in Field_longstr::compress

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.3
    • Fix Version/s: 10.3.6
    • Component/s: Server
    • Labels:
      None
    • Sprint:
      10.3.6-1

      Description

      CREATE TABLE t1 (b BLOB COMPRESSED);
      INSERT INTO t1 VALUES ('foo'),('bar');
       
      SET SESSION optimizer_switch = 'derived_merge=off';
      SELECT * FROM ( SELECT * FROM t1 ) AS sq;
       
      # Cleanup
      DROP TABLE t1;
      

      10.3 21239bb0fd2 ASAN

      ==27270==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x60c00000cef1,0x60c00000cef4) and [0x60c00000cef0, 0x60c00000cef3) overlap
          #0 0x7faa1946d91f (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x2e91f)
          #1 0x559fc80b01c7 in Field_longstr::compress(char*, unsigned int*, char const*, unsigned int, charset_info_st const*) /data/src/10.3/sql/field.cc:7838
          #2 0x559fc80b8891 in Field_blob_compressed::store(char const*, unsigned int, charset_info_st const*) /data/src/10.3/sql/field.cc:8515
          #3 0x559fc80da59a in Field_blob::store_field(Field*) /data/src/10.3/sql/field.h:3412
          #4 0x559fc80e8737 in field_conv_incompatible /data/src/10.3/sql/field_conv.cc:835
          #5 0x559fc80e87d4 in field_conv(Field*, Field*) /data/src/10.3/sql/field_conv.cc:848
          #6 0x559fc81675be in save_field_in_field /data/src/10.3/sql/item.cc:6724
          #7 0x559fc8167aba in Item_field::save_in_field(Field*, bool) /data/src/10.3/sql/item.cc:6770
          #8 0x559fc7929689 in fill_record(THD*, TABLE*, Field**, List<Item>&, bool, bool) /data/src/10.3/sql/sql_base.cc:8398
          #9 0x559fc7c819cd in select_unit::send_data(List<Item>&) /data/src/10.3/sql/sql_union.cc:128
          #10 0x559fc7b5ca32 in end_send /data/src/10.3/sql/sql_select.cc:19968
          #11 0x559fc7b54dd2 in evaluate_join_record /data/src/10.3/sql/sql_select.cc:19019
          #12 0x559fc7b539a8 in sub_select(JOIN*, st_join_table*, bool) /data/src/10.3/sql/sql_select.cc:18799
          #13 0x559fc7b51cc4 in do_select /data/src/10.3/sql/sql_select.cc:18339
          #14 0x559fc7aefe20 in JOIN::exec_inner() /data/src/10.3/sql/sql_select.cc:3636
          #15 0x559fc7aeda5d in JOIN::exec() /data/src/10.3/sql/sql_select.cc:3431
          #16 0x559fc7af0f5d in mysql_select(THD*, TABLE_LIST*, unsigned int, 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/src/10.3/sql/sql_select.cc:3835
          #17 0x559fc79acfc5 in mysql_derived_fill(THD*, LEX*, TABLE_LIST*) /data/src/10.3/sql/sql_derived.cc:1134
          #18 0x559fc79a76c6 in mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) /data/src/10.3/sql/sql_derived.cc:197
          #19 0x559fc7b291d0 in st_join_table::preread_init() /data/src/10.3/sql/sql_select.cc:12066
          #20 0x559fc7b5345c in sub_select(JOIN*, st_join_table*, bool) /data/src/10.3/sql/sql_select.cc:18767
          #21 0x559fc7b51cc4 in do_select /data/src/10.3/sql/sql_select.cc:18339
          #22 0x559fc7aefe20 in JOIN::exec_inner() /data/src/10.3/sql/sql_select.cc:3636
          #23 0x559fc7aeda5d in JOIN::exec() /data/src/10.3/sql/sql_select.cc:3431
          #24 0x559fc7af0f5d in mysql_select(THD*, TABLE_LIST*, unsigned int, 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/src/10.3/sql/sql_select.cc:3835
          #25 0x559fc7acfc7a in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.3/sql/sql_select.cc:375
          #26 0x559fc7a52406 in execute_sqlcom_select /data/src/10.3/sql/sql_parse.cc:6499
          #27 0x559fc7a4084d in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:3739
          #28 0x559fc7a5a77b in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7956
          #29 0x559fc7a35278 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1825
          #30 0x559fc7a322d9 in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1369
          #31 0x559fc7d86139 in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1401
          #32 0x559fc7d85b4e in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1307
          #33 0x559fc88a4556 in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1863
          #34 0x7faa19229493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
          #35 0x7faa1760f93e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe893e)
       
      0x60c00000cef1 is located 113 bytes inside of 124-byte region [0x60c00000ce80,0x60c00000cefc)
      allocated by thread T5 here:
          #0 0x7faa1949373f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
          #1 0x559fc929b360 in sf_malloc /data/src/10.3/mysys/safemalloc.c:118
          #2 0x559fc926a061 in my_malloc /data/src/10.3/mysys/my_malloc.c:101
          #3 0x559fc7c183df in String::realloc_raw(unsigned long) /data/src/10.3/sql/sql_string.cc:101
          #4 0x559fc78256e6 in String::realloc(unsigned long) /data/src/10.3/sql/sql_string.h:376
          #5 0x559fc7c191f5 in String::copy() /data/src/10.3/sql/sql_string.cc:212
          #6 0x559fc80da4b5 in Field_blob::store_field(Field*) /data/src/10.3/sql/field.h:3411
          #7 0x559fc80e8737 in field_conv_incompatible /data/src/10.3/sql/field_conv.cc:835
          #8 0x559fc80e87d4 in field_conv(Field*, Field*) /data/src/10.3/sql/field_conv.cc:848
          #9 0x559fc81675be in save_field_in_field /data/src/10.3/sql/item.cc:6724
          #10 0x559fc8167aba in Item_field::save_in_field(Field*, bool) /data/src/10.3/sql/item.cc:6770
          #11 0x559fc7929689 in fill_record(THD*, TABLE*, Field**, List<Item>&, bool, bool) /data/src/10.3/sql/sql_base.cc:8398
          #12 0x559fc7c819cd in select_unit::send_data(List<Item>&) /data/src/10.3/sql/sql_union.cc:128
          #13 0x559fc7b5ca32 in end_send /data/src/10.3/sql/sql_select.cc:19968
          #14 0x559fc7b54dd2 in evaluate_join_record /data/src/10.3/sql/sql_select.cc:19019
          #15 0x559fc7b539a8 in sub_select(JOIN*, st_join_table*, bool) /data/src/10.3/sql/sql_select.cc:18799
          #16 0x559fc7b51cc4 in do_select /data/src/10.3/sql/sql_select.cc:18339
          #17 0x559fc7aefe20 in JOIN::exec_inner() /data/src/10.3/sql/sql_select.cc:3636
          #18 0x559fc7aeda5d in JOIN::exec() /data/src/10.3/sql/sql_select.cc:3431
          #19 0x559fc7af0f5d in mysql_select(THD*, TABLE_LIST*, unsigned int, 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/src/10.3/sql/sql_select.cc:3835
          #20 0x559fc79acfc5 in mysql_derived_fill(THD*, LEX*, TABLE_LIST*) /data/src/10.3/sql/sql_derived.cc:1134
          #21 0x559fc79a76c6 in mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) /data/src/10.3/sql/sql_derived.cc:197
          #22 0x559fc7b291d0 in st_join_table::preread_init() /data/src/10.3/sql/sql_select.cc:12066
          #23 0x559fc7b5345c in sub_select(JOIN*, st_join_table*, bool) /data/src/10.3/sql/sql_select.cc:18767
          #24 0x559fc7b51cc4 in do_select /data/src/10.3/sql/sql_select.cc:18339
          #25 0x559fc7aefe20 in JOIN::exec_inner() /data/src/10.3/sql/sql_select.cc:3636
          #26 0x559fc7aeda5d in JOIN::exec() /data/src/10.3/sql/sql_select.cc:3431
          #27 0x559fc7af0f5d in mysql_select(THD*, TABLE_LIST*, unsigned int, 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/src/10.3/sql/sql_select.cc:3835
          #28 0x559fc7acfc7a in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.3/sql/sql_select.cc:375
          #29 0x559fc7a52406 in execute_sqlcom_select /data/src/10.3/sql/sql_parse.cc:6499
       
      Thread T5 created by T0 here:
          #0 0x7faa19462bba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
          #1 0x559fc88a4b1e in spawn_thread_v1 /data/src/10.3/storage/perfschema/pfs.cc:1913
          #2 0x559fc7802cef in inline_mysql_thread_create /data/src/10.3/include/mysql/psi/mysql_thread.h:1239
          #3 0x559fc7817f6a in create_thread_to_handle_connection(CONNECT*) /data/src/10.3/sql/mysqld.cc:6517
          #4 0x559fc781866f in create_new_thread /data/src/10.3/sql/mysqld.cc:6587
          #5 0x559fc7819680 in handle_connections_sockets() /data/src/10.3/sql/mysqld.cc:6862
          #6 0x559fc7817422 in mysqld_main(int, char**) /data/src/10.3/sql/mysqld.cc:6135
          #7 0x559fc780121f in main /data/src/10.3/sql/main.cc:25
          #8 0x7faa175472b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
       
      0x60c00000cef0 is located 112 bytes inside of 124-byte region [0x60c00000ce80,0x60c00000cefc)
          #0 0x7faa1949373f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
          #1 0x559fc929b360 in sf_malloc /data/src/10.3/mysys/safemalloc.c:118
          #2 0x559fc926a061 in my_malloc /data/src/10.3/mysys/my_malloc.c:101
          #3 0x559fc7c183df in String::realloc_raw(unsigned long) /data/src/10.3/sql/sql_string.cc:101
          #4 0x559fc78256e6 in String::realloc(unsigned long) /data/src/10.3/sql/sql_string.h:376
          #5 0x559fc7c191f5 in String::copy() /data/src/10.3/sql/sql_string.cc:212
          #6 0x559fc80da4b5 in Field_blob::store_field(Field*) /data/src/10.3/sql/field.h:3411
          #7 0x559fc80e8737 in field_conv_incompatible /data/src/10.3/sql/field_conv.cc:835
          #8 0x559fc80e87d4 in field_conv(Field*, Field*) /data/src/10.3/sql/field_conv.cc:848
          #9 0x559fc81675be in save_field_in_field /data/src/10.3/sql/item.cc:6724
          #10 0x559fc8167aba in Item_field::save_in_field(Field*, bool) /data/src/10.3/sql/item.cc:6770
          #11 0x559fc7929689 in fill_record(THD*, TABLE*, Field**, List<Item>&, bool, bool) /data/src/10.3/sql/sql_base.cc:8398
          #12 0x559fc7c819cd in select_unit::send_data(List<Item>&) /data/src/10.3/sql/sql_union.cc:128
          #13 0x559fc7b5ca32 in end_send /data/src/10.3/sql/sql_select.cc:19968
          #14 0x559fc7b54dd2 in evaluate_join_record /data/src/10.3/sql/sql_select.cc:19019
          #15 0x559fc7b539a8 in sub_select(JOIN*, st_join_table*, bool) /data/src/10.3/sql/sql_select.cc:18799
          #16 0x559fc7b51cc4 in do_select /data/src/10.3/sql/sql_select.cc:18339
          #17 0x559fc7aefe20 in JOIN::exec_inner() /data/src/10.3/sql/sql_select.cc:3636
          #18 0x559fc7aeda5d in JOIN::exec() /data/src/10.3/sql/sql_select.cc:3431
          #19 0x559fc7af0f5d in mysql_select(THD*, TABLE_LIST*, unsigned int, 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/src/10.3/sql/sql_select.cc:3835
          #20 0x559fc79acfc5 in mysql_derived_fill(THD*, LEX*, TABLE_LIST*) /data/src/10.3/sql/sql_derived.cc:1134
          #21 0x559fc79a76c6 in mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) /data/src/10.3/sql/sql_derived.cc:197
          #22 0x559fc7b291d0 in st_join_table::preread_init() /data/src/10.3/sql/sql_select.cc:12066
          #23 0x559fc7b5345c in sub_select(JOIN*, st_join_table*, bool) /data/src/10.3/sql/sql_select.cc:18767
          #24 0x559fc7b51cc4 in do_select /data/src/10.3/sql/sql_select.cc:18339
          #25 0x559fc7aefe20 in JOIN::exec_inner() /data/src/10.3/sql/sql_select.cc:3636
          #26 0x559fc7aeda5d in JOIN::exec() /data/src/10.3/sql/sql_select.cc:3431
          #27 0x559fc7af0f5d in mysql_select(THD*, TABLE_LIST*, unsigned int, 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/src/10.3/sql/sql_select.cc:3835
          #28 0x559fc7acfc7a in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.3/sql/sql_select.cc:375
          #29 0x559fc7a52406 in execute_sqlcom_select /data/src/10.3/sql/sql_parse.cc:6499
       
      SUMMARY: AddressSanitizer: memcpy-param-overlap ??:0 ??
      

        Attachments

          Activity

            People

            Assignee:
            svoj Sergey Vojtovich
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration