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

VARCHAR(1) COMPRESSED crashes the server

    XMLWordPrintable

    Details

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

      Description

      Test:

      CREATE TABLE t1(a VARCHAR(1) COMPRESSED);
      SET column_compression_threshold=0;
      INSERT INTO t1 VALUES('a');
      DROP TABLE t1;
      

      Stack trace:

      ==22237==ERROR: AddressSanitizer: unknown-crash on address 0x61900009cf0c at pc 0x7f86e12b9904 bp 0x7f86d4224f90 sp 0x7f86d4224738
      WRITE of size 3 at 0x61900009cf0c thread T5
          #0 0x7f86e12b9903 in __asan_memcpy (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x8c903)
          #1 0x7f86e0a01dac  (/lib/x86_64-linux-gnu/libz.so.1+0x3dac)
          #2 0x7f86e0a02906 in deflate (/lib/x86_64-linux-gnu/libz.so.1+0x4906)
          #3 0x560d73b323e3 in compress_zlib /home/svoj/devel/maria/mariadb/sql/field_comp.cc:51
          #4 0x560d73afb945 in Field_longstr::compress(char*, unsigned int*, char const*, unsigned int, charset_info_st const*) /home/svoj/devel/maria/mariadb/sql/field.cc:8027
          #5 0x560d73afc4bd in Field_varstring_compressed::store(char const*, unsigned long, charset_info_st const*) /home/svoj/devel/maria/mariadb/sql/field.cc:8092
          #6 0x560d73b8127d in Item::save_str_value_in_field(Field*, String*) /home/svoj/devel/maria/mariadb/sql/item.cc:499
          #7 0x560d73bb29ee in Item_string::save_in_field(Field*, bool) /home/svoj/devel/maria/mariadb/sql/item.cc:7006
          #8 0x560d73367d59 in fill_record(THD*, TABLE*, Field**, List<Item>&, bool, bool) /home/svoj/devel/maria/mariadb/sql/sql_base.cc:8457
          #9 0x560d733681a2 in fill_record_n_invoke_before_triggers(THD*, TABLE*, Field**, List<Item>&, bool, trg_event_type) /home/svoj/devel/maria/mariadb/sql/sql_base.cc:8510
          #10 0x560d733fff83 in mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool) /home/svoj/devel/maria/mariadb/sql/sql_insert.cc:1011
          #11 0x560d7348fa95 in mysql_execute_command(THD*) /home/svoj/devel/maria/mariadb/sql/sql_parse.cc:4724
          #12 0x560d734a4c5d in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /home/svoj/devel/maria/mariadb/sql/sql_parse.cc:8013
          #13 0x560d7347f997 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /home/svoj/devel/maria/mariadb/sql/sql_parse.cc:1842
          #14 0x560d7347c9be in do_command(THD*) /home/svoj/devel/maria/mariadb/sql/sql_parse.cc:1387
          #15 0x560d737ca5f5 in do_handle_one_connection(CONNECT*) /home/svoj/devel/maria/mariadb/sql/sql_connect.cc:1402
          #16 0x560d737c9f5b in handle_one_connection /home/svoj/devel/maria/mariadb/sql/sql_connect.cc:1308
          #17 0x560d74058ac2 in pfs_spawn_thread /home/svoj/devel/maria/mariadb/storage/perfschema/pfs.cc:1862
          #18 0x7f86df9ba6b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
          #19 0x7f86dee4f41c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)
       
      0x61900009cf0c is located 140 bytes inside of 1100-byte region [0x61900009ce80,0x61900009d2cc)
      allocated by thread T5 here:
          #0 0x7f86e12c5602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
          #1 0x560d74c1e496 in sf_malloc /home/svoj/devel/maria/mariadb/mysys/safemalloc.c:118
          #2 0x560d74bee916 in my_malloc /home/svoj/devel/maria/mariadb/mysys/my_malloc.c:101
          #3 0x560d74bcf0d9 in alloc_root /home/svoj/devel/maria/mariadb/mysys/my_alloc.c:249
          #4 0x560d73717bc3 in open_table_from_share(THD*, TABLE_SHARE*, st_mysql_const_lex_string const*, unsigned int, unsigned int, unsigned int, TABLE*, bool, List<String>*) /home/svoj/devel/maria/mariadb/sql/table.cc:3211
          #5 0x560d73344f99 in open_table(THD*, TABLE_LIST*, Open_table_context*) /home/svoj/devel/maria/mariadb/sql/sql_base.cc:1924
          #6 0x560d7334bd4f in open_and_process_table /home/svoj/devel/maria/mariadb/sql/sql_base.cc:3512
          #7 0x560d7334e667 in open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) /home/svoj/devel/maria/mariadb/sql/sql_base.cc:4032
          #8 0x560d73352c56 in open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) /home/svoj/devel/maria/mariadb/sql/sql_base.cc:4907
          #9 0x560d732cc539 in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /home/svoj/devel/maria/mariadb/sql/sql_base.h:489
          #10 0x560d733fe766 in mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool) /home/svoj/devel/maria/mariadb/sql/sql_insert.cc:766
          #11 0x560d7348fa95 in mysql_execute_command(THD*) /home/svoj/devel/maria/mariadb/sql/sql_parse.cc:4724
          #12 0x560d734a4c5d in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /home/svoj/devel/maria/mariadb/sql/sql_parse.cc:8013
          #13 0x560d7347f997 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /home/svoj/devel/maria/mariadb/sql/sql_parse.cc:1842
          #14 0x560d7347c9be in do_command(THD*) /home/svoj/devel/maria/mariadb/sql/sql_parse.cc:1387
          #15 0x560d737ca5f5 in do_handle_one_connection(CONNECT*) /home/svoj/devel/maria/mariadb/sql/sql_connect.cc:1402
          #16 0x560d737c9f5b in handle_one_connection /home/svoj/devel/maria/mariadb/sql/sql_connect.cc:1308
          #17 0x560d74058ac2 in pfs_spawn_thread /home/svoj/devel/maria/mariadb/storage/perfschema/pfs.cc:1862
          #18 0x7f86df9ba6b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
       
      Thread T5 created by T0 here:
          #0 0x7f86e1263253 in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x36253)
          #1 0x560d74058eaf in spawn_thread_v1 /home/svoj/devel/maria/mariadb/storage/perfschema/pfs.cc:1912
          #2 0x560d732094ae in inline_mysql_thread_create /home/svoj/devel/maria/mariadb/include/mysql/psi/mysql_thread.h:1268
          #3 0x560d7321e6cf in create_thread_to_handle_connection(CONNECT*) /home/svoj/devel/maria/mariadb/sql/mysqld.cc:6534
          #4 0x560d7321edcf in create_new_thread /home/svoj/devel/maria/mariadb/sql/mysqld.cc:6604
          #5 0x560d7321fe0c in handle_connections_sockets() /home/svoj/devel/maria/mariadb/sql/mysqld.cc:6879
          #6 0x560d7321db8a in mysqld_main(int, char**) /home/svoj/devel/maria/mariadb/sql/mysqld.cc:6156
          #7 0x560d732078bf in main /home/svoj/devel/maria/mariadb/sql/main.cc:25
          #8 0x7f86ded6882f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
       
      SUMMARY: AddressSanitizer: unknown-crash ??:0 __asan_memcpy
      Shadow bytes around the buggy address:
        0x0c328000b990: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c328000b9a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c328000b9b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c328000b9c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c328000b9d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>0x0c328000b9e0: 00[04]04 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c328000b9f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c328000ba00: 00 00 00 00 00 00 00 00 00 00 f7 f7 f7 f7 f7 f7
        0x0c328000ba10: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c328000ba20: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c328000ba30: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
      Shadow byte legend (one shadow byte represents 8 application bytes):
        Addressable:           00
        Partially addressable: 01 02 03 04 05 06 07
        Heap left redzone:       fa
        Heap right redzone:      fb
        Freed heap region:       fd
        Stack left redzone:      f1
        Stack mid redzone:       f2
        Stack right redzone:     f3
        Stack partial redzone:   f4
        Stack after return:      f5
        Stack use after scope:   f8
        Global redzone:          f9
        Global init order:       f6
        Poisoned by user:        f7
        Container overflow:      fc
        Array cookie:            ac
        Intra object redzone:    bb
        ASan internal:           fe
      ==22237==ABORTING
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: